-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
strategy.go
34 lines (27 loc) · 1.16 KB
/
strategy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright © 2024 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2
import (
"context"
"github.com/ory/fosite"
)
type CoreStrategy interface {
AccessTokenStrategy
RefreshTokenStrategy
AuthorizeCodeStrategy
}
type AccessTokenStrategy interface {
AccessTokenSignature(ctx context.Context, token string) string
GenerateAccessToken(ctx context.Context, requester fosite.Requester) (token string, signature string, err error)
ValidateAccessToken(ctx context.Context, requester fosite.Requester, token string) (err error)
}
type RefreshTokenStrategy interface {
RefreshTokenSignature(ctx context.Context, token string) string
GenerateRefreshToken(ctx context.Context, requester fosite.Requester) (token string, signature string, err error)
ValidateRefreshToken(ctx context.Context, requester fosite.Requester, token string) (err error)
}
type AuthorizeCodeStrategy interface {
AuthorizeCodeSignature(ctx context.Context, token string) string
GenerateAuthorizeCode(ctx context.Context, requester fosite.Requester) (token string, signature string, err error)
ValidateAuthorizeCode(ctx context.Context, requester fosite.Requester, token string) (err error)
}