server: change ClientMetadata -> Client
Metadata is not enough these days - we're going to need access to the Public field as well.
This commit is contained in:
parent
c0668997ae
commit
4f85f3a479
2 changed files with 8 additions and 7 deletions
|
@ -188,7 +188,7 @@ func renderLoginPage(w http.ResponseWriter, r *http.Request, srv OIDCServer, idp
|
|||
|
||||
// Render error message if client id is invalid.
|
||||
clientID := q.Get("client_id")
|
||||
cm, err := srv.ClientMetadata(clientID)
|
||||
_, err := srv.Client(clientID)
|
||||
if err != nil {
|
||||
log.Errorf("Failed fetching client %q from repo: %v", clientID, err)
|
||||
td.Error = true
|
||||
|
@ -196,7 +196,7 @@ func renderLoginPage(w http.ResponseWriter, r *http.Request, srv OIDCServer, idp
|
|||
execTemplate(w, tpl, td)
|
||||
return
|
||||
}
|
||||
if cm == nil {
|
||||
if err == client.ErrorNotFound {
|
||||
td.Error = true
|
||||
td.Message = "Authentication Error"
|
||||
td.Detail = "Invalid client ID"
|
||||
|
@ -299,13 +299,14 @@ func handleAuthFunc(srv OIDCServer, idpcs []connector.Connector, tpl *template.T
|
|||
return
|
||||
}
|
||||
|
||||
cm, err := srv.ClientMetadata(acr.ClientID)
|
||||
cli, err := srv.Client(acr.ClientID)
|
||||
cm := cli.Metadata
|
||||
if err != nil {
|
||||
log.Errorf("Failed fetching client %q from repo: %v", acr.ClientID, err)
|
||||
writeAuthError(w, oauth2.NewError(oauth2.ErrorServerError), acr.State)
|
||||
return
|
||||
}
|
||||
if cm == nil {
|
||||
if err == client.ErrorNotFound {
|
||||
log.Errorf("Client %q not found", acr.ClientID)
|
||||
writeAuthError(w, oauth2.NewError(oauth2.ErrorInvalidRequest), acr.State)
|
||||
return
|
||||
|
|
|
@ -43,7 +43,7 @@ const (
|
|||
)
|
||||
|
||||
type OIDCServer interface {
|
||||
ClientMetadata(string) (*oidc.ClientMetadata, error)
|
||||
Client(string) (client.Client, error)
|
||||
NewSession(connectorID, clientID, clientState string, redirectURL url.URL, nonce string, register bool, scope []string) (string, error)
|
||||
Login(oidc.Identity, string) (string, error)
|
||||
|
||||
|
@ -290,8 +290,8 @@ func (s *Server) NewClientTokenAuthHandler(handler http.Handler) http.Handler {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Server) ClientMetadata(clientID string) (*oidc.ClientMetadata, error) {
|
||||
return s.ClientManager.Metadata(clientID)
|
||||
func (s *Server) Client(clientID string) (client.Client, error) {
|
||||
return s.ClientManager.Get(clientID)
|
||||
}
|
||||
|
||||
func (s *Server) NewSession(ipdcID, clientID, clientState string, redirectURL url.URL, nonce string, register bool, scope []string) (string, error) {
|
||||
|
|
Reference in a new issue