MCPcopy
hub / github.com/ory/hydra / decodeFlow

Function decodeFlow

flow/flow_encoding.go:25–40  ·  view source on GitHub ↗
(ctx context.Context, d decodeDependencies, enc string, p purpose)

Source from the content-addressed store, hash-verified

23}
24
25func decodeFlow(ctx context.Context, d decodeDependencies, enc string, p purpose) (_ *Flow, err error) {
26 f, err := Decode[Flow](ctx, d.FlowCipher(), enc, withPurpose(p))
27 if err != nil {
28 return nil, errors.WithStack(x.ErrNotFound.WithWrap(err))
29 }
30
31 if f.NID != d.Networker().NetworkID(ctx) {
32 return nil, errors.WithStack(x.ErrNotFound.WithDescription("Network IDs are not matching."))
33 }
34
35 if f.RequestedAt.Add(d.Config().ConsentRequestMaxAge(ctx)).Before(time.Now()) {
36 return nil, errors.WithStack(fosite.ErrRequestUnauthorized.WithHintf("The %s request has expired, please try again.", p.RequestType()))
37 }
38
39 return f, nil
40}
41
42func DecodeFromLoginChallenge(ctx context.Context, d decodeDependencies, challenge string) (_ *Flow, err error) {
43 ctx, span := d.Tracer(ctx).Tracer().Start(ctx, "flow.DecodeFromLoginChallenge")

Callers 4

DecodeFromLoginChallengeFunction · 0.85
decodeVerifierFunction · 0.85

Calls 12

withPurposeFunction · 0.85
WithWrapMethod · 0.80
WithDescriptionMethod · 0.80
ConsentRequestMaxAgeMethod · 0.80
WithHintfMethod · 0.80
RequestTypeMethod · 0.80
FlowCipherMethod · 0.65
NetworkIDMethod · 0.65
NetworkerMethod · 0.65
AddMethod · 0.65
ConfigMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected