CreateAccessToken implements the op.Storage interface it will be called for all requests able to return an access token (Authorization Code Flow, Implicit Flow, JWT Profile, ...)
(ctx context.Context, request op.TokenRequest)
| 270 | // CreateAccessToken implements the op.Storage interface |
| 271 | // it will be called for all requests able to return an access token (Authorization Code Flow, Implicit Flow, JWT Profile, ...) |
| 272 | func (s *Storage) CreateAccessToken(ctx context.Context, request op.TokenRequest) (string, time.Time, error) { |
| 273 | var applicationID string |
| 274 | switch req := request.(type) { |
| 275 | case *AuthRequest: |
| 276 | // if authenticated for an app (auth code / implicit flow) we must save the client_id to the token |
| 277 | applicationID = req.ApplicationID |
| 278 | case op.TokenExchangeRequest: |
| 279 | applicationID = req.GetClientID() |
| 280 | } |
| 281 | |
| 282 | token, err := s.accessToken(applicationID, "", request.GetSubject(), request.GetAudience(), request.GetScopes()) |
| 283 | if err != nil { |
| 284 | return "", time.Time{}, err |
| 285 | } |
| 286 | return token.ID, token.Expiration, nil |
| 287 | } |
| 288 | |
| 289 | // CreateAccessAndRefreshTokens implements the op.Storage interface |
| 290 | // it will be called for all requests able to return an access and refresh token (Authorization Code Flow, Refresh Token Request) |
nothing calls this directly
no test coverage detected