MCPcopy
hub / github.com/zitadel/oidc / CreateAccessToken

Method CreateAccessToken

example/server/storage/storage.go:257–272  ·  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

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

Callers

nothing calls this directly

Implementers 7

Storageexample/server/storage/storage.go
multiStorageexample/server/storage/storage_dynamic
UnimplementedServerpkg/op/server.go
LegacyServerpkg/op/server_legacy.go
Sigpkg/op/mock/authorizer.mock.impl.go
MockStoragepkg/op/mock/storage.mock.go
MockStorageMockRecorderpkg/op/mock/storage.mock.go

Calls 5

accessTokenMethod · 0.95
GetClientIDMethod · 0.65
GetSubjectMethod · 0.65
GetAudienceMethod · 0.65
GetScopesMethod · 0.65

Tested by

no test coverage detected