Update internal/oidc/token_exchange.go for latest Fosite version.
The `fosite.TokenEndpointHandler` changed and now requires some additional methods. Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
234465789b
commit
c832cab8d0
@ -40,8 +40,10 @@ type TokenExchangeHandler struct {
|
|||||||
accessTokenStorage oauth2.AccessTokenStorage
|
accessTokenStorage oauth2.AccessTokenStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ fosite.TokenEndpointHandler = (*TokenExchangeHandler)(nil)
|
||||||
|
|
||||||
func (t *TokenExchangeHandler) HandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) error {
|
func (t *TokenExchangeHandler) HandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) error {
|
||||||
if !(requester.GetGrantTypes().ExactOne("urn:ietf:params:oauth:grant-type:token-exchange")) {
|
if !t.CanHandleTokenEndpointRequest(requester) {
|
||||||
return errors.WithStack(fosite.ErrUnknownRequest)
|
return errors.WithStack(fosite.ErrUnknownRequest)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -139,3 +141,11 @@ func (t *TokenExchangeHandler) validateAccessToken(ctx context.Context, requeste
|
|||||||
}
|
}
|
||||||
return originalRequester, nil
|
return originalRequester, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *TokenExchangeHandler) CanSkipClientAuth(_ fosite.AccessRequester) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *TokenExchangeHandler) CanHandleTokenEndpointRequest(requester fosite.AccessRequester) bool {
|
||||||
|
return requester.GetGrantTypes().ExactOne("urn:ietf:params:oauth:grant-type:token-exchange")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user