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:
Bobby Rullo 2016-06-17 11:55:21 -07:00
parent c0668997ae
commit 4f85f3a479
2 changed files with 8 additions and 7 deletions

View file

@ -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

View file

@ -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) {