forked from ory/fosite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy.go
30 lines (25 loc) · 1.05 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
package oauth2
import (
"github.com/ory-am/fosite"
"golang.org/x/net/context"
)
type CoreStrategy interface {
AccessTokenStrategy
RefreshTokenStrategy
AuthorizeCodeStrategy
}
type AccessTokenStrategy interface {
AccessTokenSignature(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(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(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)
}