From e5ecaf01a0179c431c6a56bfb2b923e503a02610 Mon Sep 17 00:00:00 2001 From: Margo Crawford Date: Mon, 7 Dec 2020 17:28:51 -0800 Subject: [PATCH] WIP stubbing out tokenexchangehandler --- internal/oidc/oidc.go | 2 +- internal/oidc/token_exchange.go | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 internal/oidc/token_exchange.go diff --git a/internal/oidc/oidc.go b/internal/oidc/oidc.go index 7c550751..81c7d54c 100644 --- a/internal/oidc/oidc.go +++ b/internal/oidc/oidc.go @@ -83,7 +83,7 @@ func PinnipedCLIOIDCClient() *fosite.DefaultOpenIDConnectClient { Public: true, RedirectURIs: []string{"http://127.0.0.1/callback"}, ResponseTypes: []string{"code"}, - GrantTypes: []string{"authorization_code"}, + GrantTypes: []string{"authorization_code", "token_exchange"}, Scopes: []string{"openid", "profile", "email"}, }, TokenEndpointAuthMethod: "none", diff --git a/internal/oidc/token_exchange.go b/internal/oidc/token_exchange.go new file mode 100644 index 00000000..2f3f1ee1 --- /dev/null +++ b/internal/oidc/token_exchange.go @@ -0,0 +1,23 @@ +package oidc + +import ( + "context" + + "github.com/ory/fosite" + "github.com/ory/fosite/compose" +) + +func TokenExchangeFactory(config *compose.Config, storage interface{}, strategy interface{}) interface{} { + return &TokenExchangeHandler{} +} + +type TokenExchangeHandler struct { +} + +func (t *TokenExchangeHandler) HandleTokenEndpointRequest(ctx context.Context, requester fosite.AccessRequester) error { + return nil +} + +func (t *TokenExchangeHandler) PopulateTokenEndpointResponse(ctx context.Context, requester fosite.AccessRequester, responder fosite.AccessResponder) error { + return nil +}