-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathinterface.go
More file actions
41 lines (35 loc) · 1.04 KB
/
interface.go
File metadata and controls
41 lines (35 loc) · 1.04 KB
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
35
36
37
38
39
40
41
package repository
import (
"context"
"encoding/json"
"fmt"
"github.com/ory/fosite"
"github.com/ory/fosite/handler/oauth2"
"github.com/ory/fosite/handler/pkce"
)
type Repository interface {
fosite.Storage
oauth2.CoreStorage
oauth2.TokenRevocationStorage
pkce.PKCERequestStorage
DynamicClientStorage
AuthorizeRequestStorage
Close() error
}
type DynamicClientStorage interface {
RegisterClient(ctx context.Context, client fosite.Client) error
}
type AuthorizeRequestStorage interface {
CreateAuthorizeRequest(ctx context.Context, request fosite.AuthorizeRequester) error
GetAuthorizeRequest(ctx context.Context, requestID string) (fosite.AuthorizeRequester, error)
DeleteAuthorizeRequest(ctx context.Context, requestID string) error
}
func restoreSession(req *fosite.Request, sessionData json.RawMessage, sess fosite.Session) error {
if len(sessionData) > 0 && sess != nil {
if err := json.Unmarshal(sessionData, sess); err != nil {
return fmt.Errorf("failed to unmarshal session data: %w", err)
}
req.SetSession(sess)
}
return nil
}