Commit 51dc861a authored by lixiang's avatar lixiang

modify domain name

parent b02c6277
This diff is collapsed.
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
如果修改了main中的go文件,就需重新编译(需要go环境) 如果修改了main中的go文件,就需重新编译(需要go环境)
编译: 编译:
bash
cd conf/extensions cd conf/extensions
GOOS=linux GOARCH=386 go build ../../main/authentication.go GOOS=linux GOARCH=386 go build ../../main/authentication.go
......
version: "2.3" version: "3.6"
services: services:
registry: registry:
image: registry:2 image: registry:2
...@@ -12,7 +12,7 @@ services: ...@@ -12,7 +12,7 @@ services:
- REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/data - REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/data
- REGISTRY_STORAGE_DELETE_ENABLED=true - REGISTRY_STORAGE_DELETE_ENABLED=true
- REGISTRY_AUTH=token - REGISTRY_AUTH=token
- REGISTRY_AUTH_TOKEN_REALM=https://ce-z1.cloudam.cn:5001/auth - REGISTRY_AUTH_TOKEN_REALM=https://ce-z1.bkunyun.com:5001/auth
- REGISTRY_AUTH_TOKEN_SERVICE="CE-Z1" - REGISTRY_AUTH_TOKEN_SERVICE="CE-Z1"
- REGISTRY_AUTH_TOKEN_ISSUER="AuthService" - REGISTRY_AUTH_TOKEN_ISSUER="AuthService"
- REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/ssl/ssl.pem - REGISTRY_AUTH_TOKEN_ROOTCERTBUNDLE=/ssl/ssl.pem
......
module docker-registry
go 1.13
require github.com/cesanta/docker_auth/auth_server v0.0.0-20230505183229-057a0bc622f1
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package main package main
import ( import (
"strings" "docker-registry/utils"
"os"
"fmt" "fmt"
utils "../utils" "os"
"strings"
) )
func main() { func main() {
text := utils.ReadStdIn() text := utils.ReadStdIn()
credentials := strings.Split(text, " ") credentials := strings.Split(text, " ")
...@@ -23,7 +21,7 @@ func main() { ...@@ -23,7 +21,7 @@ func main() {
re, _ := utils.HttpLogin(uName, password) re, _ := utils.HttpLogin(uName, password)
isUserAuthenticated := re isUserAuthenticated := re
if (strings.EqualFold(uName, "root") && strings.EqualFold(password, "bkunyun2021")) { if strings.EqualFold(uName, "root") && strings.EqualFold(password, "bkunyun2021") {
isUserAuthenticated = true isUserAuthenticated = true
} }
......
package main package main
import ( import (
"docker-registry/utils"
"encoding/json" "encoding/json"
"os"
"github.com/cesanta/docker_auth/auth_server/authz"
"fmt" "fmt"
utils "../utils" "os"
)
"github.com/cesanta/docker_auth/auth_server/api"
)
func main() { func main() {
text := utils.ReadStdIn() text := utils.ReadStdIn()
// Create the authReqInfo object from the input // Create the authReqInfo object from the input
var authReqInfo authz.AuthRequestInfo var authReqInfo *api.AuthRequestInfo
err := json.Unmarshal([]byte(text), &authReqInfo) err := json.Unmarshal([]byte(text), &authReqInfo)
if err != nil { if err != nil {
os.Exit(utils.ErrorExitCode) os.Exit(utils.ErrorExitCode)
......
package main package main
import ( import (
"../utils" "docker-registry/utils"
"github.com/cesanta/docker_auth/auth_server/authz"
"github.com/cesanta/docker_auth/auth_server/api"
) )
func main() { func main() {
// utils.HttpLogin("lglhope", "123456789") // utils.HttpLogin("lglhope", "123456789")
var authRequestInfo authz.AuthRequestInfo var authRequestInfo *api.AuthRequestInfo
authRequestInfo.Account = "wln" authRequestInfo.Account = "wln"
authRequestInfo.Name = "wln/apple" authRequestInfo.Name = "wln/apple"
authRequestInfo.Service = "wln" authRequestInfo.Service = "wln"
......
...@@ -2,15 +2,16 @@ package utils ...@@ -2,15 +2,16 @@ package utils
import ( import (
"bufio" "bufio"
"os" "bytes"
"strings" "encoding/json"
"fmt"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"fmt" "os"
"github.com/cesanta/docker_auth/auth_server/authz"
"encoding/json"
"bytes"
"strconv" "strconv"
"strings"
"github.com/cesanta/docker_auth/auth_server/api"
) )
const SuccessExitCode = 0 const SuccessExitCode = 0
...@@ -64,9 +65,9 @@ func HttpLogin(username string, password string) (bool, error) { ...@@ -64,9 +65,9 @@ func HttpLogin(username string, password string) (bool, error) {
return true, nil return true, nil
} }
func HttpAuth(authReqInfo authz.AuthRequestInfo) bool { func HttpAuth(authReqInfo *api.AuthRequestInfo) bool {
client := &http.Client{} client := &http.Client{}
authUrl := "https://www.cloudam.cn/c3ce/dockerimage/authorization" authUrl := "https://www.bkunyun.com/c3ce/dockerimage/authorization"
bytesData, _ := json.Marshal(authReqInfo) bytesData, _ := json.Marshal(authReqInfo)
fmt.Println(string(bytesData)) fmt.Println(string(bytesData))
req, _ := http.NewRequest("POST", authUrl, bytes.NewReader(bytesData)) req, _ := http.NewRequest("POST", authUrl, bytes.NewReader(bytesData))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment