File tree Expand file tree Collapse file tree 1 file changed +9
-17
lines changed
Expand file tree Collapse file tree 1 file changed +9
-17
lines changed Original file line number Diff line number Diff line change @@ -60,23 +60,15 @@ func (a *AuthProvider) Register(server *grpc.Server) {
6060}
6161
6262func (a * AuthProvider ) Credentials (ctx context.Context , req * auth.CredentialsRequest ) (* auth.CredentialsResponse , error ) {
63- for _ , c := range a .credentials {
64- if c .Host == req .Host {
65- decodedAuth , err := base64 .StdEncoding .DecodeString (c .Token )
66- if err != nil {
67- return nil , err
68- }
69-
70- usernamePassword := strings .SplitN (string (decodedAuth ), ":" , 2 )
71- if len (usernamePassword ) != 2 {
72- return nil , fmt .Errorf ("invalid auth string" )
73- }
74-
75- return & auth.CredentialsResponse {
76- Username : usernamePassword [0 ],
77- Secret : usernamePassword [1 ],
78- }, nil
79- }
63+ creds , err := a .findCredentials (req .Host )
64+ if err != nil {
65+ return nil , err
66+ }
67+ if creds != nil {
68+ return & auth.CredentialsResponse {
69+ Username : creds .Username ,
70+ Secret : creds .Password ,
71+ }, nil
8072 }
8173
8274 return a .inner .Credentials (ctx , req )
You can’t perform that action at this time.
0 commit comments