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

Method accessToken

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

accessToken will store an access_token in-memory based on the provided information

(applicationID, refreshTokenID, subject string, audience, scopes []string)

Source from the content-addressed store, hash-verified

643
644// accessToken will store an access_token in-memory based on the provided information
645func (s *Storage) accessToken(applicationID, refreshTokenID, subject string, audience, scopes []string) (*Token, error) {
646 s.lock.Lock()
647 defer s.lock.Unlock()
648 token := &Token{
649 ID: uuid.NewString(),
650 ApplicationID: applicationID,
651 RefreshTokenID: refreshTokenID,
652 Subject: subject,
653 Audience: audience,
654 Expiration: time.Now().Add(s.accessTokenExpiration),
655 Scopes: scopes,
656 }
657 s.tokens[token.ID] = token
658 return token, nil
659}
660
661// setUserinfo sets the info based on the user, scopes and if necessary the clientID
662func (s *Storage) setUserinfo(ctx context.Context, userInfo *oidc.UserInfo, userID, clientID string, scopes []string) (err error) {

Callers 3

CreateAccessTokenMethod · 0.95
exchangeRefreshTokenMethod · 0.95

Calls 1

AddMethod · 0.65

Tested by

no test coverage detected