-
-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into closes-180
- Loading branch information
Showing
10 changed files
with
159 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package openid | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/ory/fosite" | ||
"github.com/pkg/errors" | ||
"time" | ||
) | ||
|
||
type OpenIDConnectRefreshHandler struct { | ||
*IDTokenHandleHelper | ||
} | ||
|
||
func (c *OpenIDConnectRefreshHandler) HandleTokenEndpointRequest(ctx context.Context, request fosite.AccessRequester) error { | ||
if !request.GetGrantTypes().Exact("refresh_token") { | ||
return errors.WithStack(fosite.ErrUnknownRequest) | ||
} | ||
|
||
if !request.GetGrantedScopes().Has("openid") { | ||
return errors.WithStack(fosite.ErrUnknownRequest) | ||
} | ||
|
||
sess, ok := request.GetSession().(Session) | ||
if !ok { | ||
return errors.New("Failed to generate id token because session must be of type fosite/handler/openid.Session") | ||
} | ||
|
||
// We need to reset the expires at value | ||
sess.IDTokenClaims().ExpiresAt = time.Time{} | ||
return nil | ||
} | ||
|
||
func (c *OpenIDConnectRefreshHandler) PopulateTokenEndpointResponse(ctx context.Context, requester fosite.AccessRequester, responder fosite.AccessResponder) error { | ||
if !requester.GetGrantTypes().Exact("refresh_token") { | ||
return errors.WithStack(fosite.ErrUnknownRequest) | ||
} | ||
|
||
if !requester.GetGrantedScopes().Has("openid") { | ||
return errors.WithStack(fosite.ErrUnknownRequest) | ||
} | ||
|
||
return c.IssueExplicitIDToken(ctx, requester, responder) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package integration |
Oops, something went wrong.