This commit is contained in:
Livio Amstutz 2019-12-02 16:15:42 +01:00
parent 2ff421188e
commit d5e1dfff61
3 changed files with 8 additions and 4 deletions

View file

@ -27,7 +27,9 @@ func (a *AuthRequest) GetAMR() []string {
}
func (a *AuthRequest) GetAudience() []string {
return []string{}
return []string{
a.ID,
}
}
func (a *AuthRequest) GetClientID() string {
@ -76,7 +78,7 @@ func (s *Storage) GetClientByClientID(id string) (op.Client, error) {
return &ConfClient{applicationType: appType}, nil
}
func (s *Storage) AuthRequestByCode(op.Client, string, string) (op.AuthRequest, error) {
return &AuthRequest{ID: "id"}, nil
return &AuthRequest{ID: "native"}, nil
}
func (s *Storage) AuthorizeClientIDSecret(string, string) (op.Client, error) {
return &ConfClient{}, nil
@ -117,6 +119,7 @@ func (c *ConfClient) RedirectURIs() []string {
return []string{
"https://registered.com/callback",
"http://localhost:9999/callback",
"http://localhost:5556/auth/callback",
"custom://callback",
}
}

View file

@ -44,7 +44,7 @@ func Start(ctx context.Context, o OpenIDProvider) {
go func() {
err := o.HttpHandler().ListenAndServe()
if err != nil {
logrus.Panic("oidc server serve failed")
logrus.Panicf("oidc server serve failed: %v", err)
}
}()
logrus.Infof("oidc server is listening on %s", o.Port())

View file

@ -15,6 +15,7 @@ import (
)
type Exchanger interface {
Issuer() string
Storage() Storage
Decoder() *schema.Decoder
Signer() Signer
@ -58,7 +59,7 @@ func CodeExchange(w http.ResponseWriter, r *http.Request, exchanger Exchanger) {
ExchangeRequestError(w, r, err)
return
}
idToken, err := CreateIDToken("", authReq, "", time.Now(), time.Now(), "", exchanger.Signer())
idToken, err := CreateIDToken(exchanger.Issuer(), authReq, "", time.Now(), time.Now(), "", exchanger.Signer())
if err != nil {
ExchangeRequestError(w, r, err)
return