@@ -7,11 +7,10 @@ import (
77 "context"
88 "time"
99
10+ "github.com/ory/fosite"
1011 "github.com/ory/x/errorsx"
1112
1213 "github.com/pkg/errors"
13-
14- "github.com/ory/fosite"
1514)
1615
1716// HandleTokenEndpointRequest implements
@@ -26,7 +25,7 @@ func (c *AuthorizeExplicitGrantHandler) HandleTokenEndpointRequest(ctx context.C
2625 }
2726
2827 code := request .GetRequestForm ().Get ("code" )
29- signature := c .AuthorizeCodeStrategy .AuthorizeCodeSignature (ctx , code )
28+ signature := c .Strategy . AuthorizeCodeStrategy () .AuthorizeCodeSignature (ctx , code )
3029 authorizeRequest , err := c .Storage .AuthorizeCodeStorage ().GetAuthorizeCodeSession (ctx , signature , request .GetSession ())
3130 if errors .Is (err , fosite .ErrInvalidatedAuthorizeCode ) {
3231 if authorizeRequest == nil {
@@ -39,11 +38,11 @@ func (c *AuthorizeExplicitGrantHandler) HandleTokenEndpointRequest(ctx context.C
3938 reqID := authorizeRequest .GetID ()
4039 hint := "The authorization code has already been used."
4140 debug := ""
42- if revErr := c .TokenRevocationStorage .TokenRevocationStorage ().RevokeAccessToken (ctx , reqID ); revErr != nil {
41+ if revErr := c .Storage .TokenRevocationStorage ().RevokeAccessToken (ctx , reqID ); revErr != nil {
4342 hint += " Additionally, an error occurred during processing the access token revocation."
4443 debug += "Revocation of access_token lead to error " + revErr .Error () + "."
4544 }
46- if revErr := c .TokenRevocationStorage .TokenRevocationStorage ().RevokeRefreshToken (ctx , reqID ); revErr != nil {
45+ if revErr := c .Storage .TokenRevocationStorage ().RevokeRefreshToken (ctx , reqID ); revErr != nil {
4746 hint += " Additionally, an error occurred during processing the refresh token revocation."
4847 debug += "Revocation of refresh_token lead to error " + revErr .Error () + "."
4948 }
@@ -56,7 +55,7 @@ func (c *AuthorizeExplicitGrantHandler) HandleTokenEndpointRequest(ctx context.C
5655
5756 // The authorization server MUST verify that the authorization code is valid
5857 // This needs to happen after store retrieval for the session to be hydrated properly
59- if err := c .AuthorizeCodeStrategy .ValidateAuthorizeCode (ctx , request , code ); err != nil {
58+ if err := c .Strategy . AuthorizeCodeStrategy () .ValidateAuthorizeCode (ctx , request , code ); err != nil {
6059 return errorsx .WithStack (fosite .ErrInvalidGrant .WithWrap (err ).WithDebug (err .Error ()))
6160 }
6261
@@ -120,11 +119,11 @@ func (c *AuthorizeExplicitGrantHandler) PopulateTokenEndpointResponse(ctx contex
120119 }
121120
122121 code := requester .GetRequestForm ().Get ("code" )
123- signature := c .AuthorizeCodeStrategy .AuthorizeCodeSignature (ctx , code )
122+ signature := c .Strategy . AuthorizeCodeStrategy () .AuthorizeCodeSignature (ctx , code )
124123 authorizeRequest , err := c .Storage .AuthorizeCodeStorage ().GetAuthorizeCodeSession (ctx , signature , requester .GetSession ())
125124 if err != nil {
126125 return errorsx .WithStack (fosite .ErrServerError .WithWrap (err ).WithDebug (err .Error ()))
127- } else if err := c .AuthorizeCodeStrategy .ValidateAuthorizeCode (ctx , requester , code ); err != nil {
126+ } else if err := c .Strategy . AuthorizeCodeStrategy () .ValidateAuthorizeCode (ctx , requester , code ); err != nil {
128127 // This needs to happen after store retrieval for the session to be hydrated properly
129128 return errorsx .WithStack (fosite .ErrInvalidRequest .WithWrap (err ).WithDebug (err .Error ()))
130129 }
@@ -137,14 +136,14 @@ func (c *AuthorizeExplicitGrantHandler) PopulateTokenEndpointResponse(ctx contex
137136 requester .GrantAudience (audience )
138137 }
139138
140- access , accessSignature , err := c .AccessTokenStrategy .GenerateAccessToken (ctx , requester )
139+ access , accessSignature , err := c .Strategy . AccessTokenStrategy () .GenerateAccessToken (ctx , requester )
141140 if err != nil {
142141 return errorsx .WithStack (fosite .ErrServerError .WithWrap (err ).WithDebug (err .Error ()))
143142 }
144143
145144 var refresh , refreshSignature string
146145 if canIssueRefreshToken (ctx , c , authorizeRequest ) {
147- refresh , refreshSignature , err = c .RefreshTokenStrategy .GenerateRefreshToken (ctx , requester )
146+ refresh , refreshSignature , err = c .Strategy . RefreshTokenStrategy () .GenerateRefreshToken (ctx , requester )
148147 if err != nil {
149148 return errorsx .WithStack (fosite .ErrServerError .WithWrap (err ).WithDebug (err .Error ()))
150149 }
0 commit comments