MCPcopy
hub / github.com/lxc/incus / CreateAccessToken

Method CreateAccessToken

test/mini-oidc/storage/storage.go:272–287  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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, ...)
272func (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)

Callers

nothing calls this directly

Calls 5

accessTokenMethod · 0.95
GetClientIDMethod · 0.45
GetSubjectMethod · 0.45
GetAudienceMethod · 0.45
GetScopesMethod · 0.45

Tested by

no test coverage detected