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)
| 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) |
| 212 | func (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 |
nothing calls this directly
no test coverage detected