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)
| 255 | // CreateAccessToken implements the op.Storage interface |
| 256 | // it will be called for all requests able to return an access token (Authorization Code Flow, Implicit Flow, JWT Profile, ...) |
| 257 | func (s *Storage) CreateAccessToken(ctx context.Context, request op.TokenRequest) (string, time.Time, error) { |
| 258 | var applicationID string |
| 259 | switch req := request.(type) { |
| 260 | case *AuthRequest: |
| 261 | // if authenticated for an app (auth code / implicit flow) we must save the client_id to the token |
| 262 | applicationID = req.ApplicationID |
| 263 | case op.TokenExchangeRequest: |
| 264 | applicationID = req.GetClientID() |
| 265 | } |
| 266 | |
| 267 | token, err := s.accessToken(applicationID, "", request.GetSubject(), request.GetAudience(), request.GetScopes()) |
| 268 | if err != nil { |
| 269 | return "", time.Time{}, err |
| 270 | } |
| 271 | return token.ID, token.Expiration, nil |
| 272 | } |
| 273 | |
| 274 | // CreateAccessAndRefreshTokens implements the op.Storage interface |
| 275 | // 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