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

Method AuthRequestByCode

example/server/storage/storage.go:212–224  ·  view source on GitHub ↗

AuthRequestByCode implements the op.Storage interface it will be called after parsing and validation of the token request (in an authorization code flow)

(ctx context.Context, code string)

Source from the content-addressed store, hash-verified

210// AuthRequestByCode implements the op.Storage interface
211// it will be called after parsing and validation of the token request (in an authorization code flow)
212func (s *Storage) AuthRequestByCode(ctx context.Context, code string) (op.AuthRequest, error) {
213 // for this example we read the id by code and then get the request by id
214 requestID, ok := func() (string, bool) {
215 s.lock.Lock()
216 defer s.lock.Unlock()
217 requestID, ok := s.codes[code]
218 return requestID, ok
219 }()
220 if !ok {
221 return nil, fmt.Errorf("code invalid or expired")
222 }
223 return s.AuthRequestByID(ctx, requestID)
224}
225
226// SaveAuthCode implements the op.Storage interface
227// it will be called after the authentication has been successful and before redirecting the user agent to the redirect_uri

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 1

AuthRequestByIDMethod · 0.95

Tested by

no test coverage detected