-
Notifications
You must be signed in to change notification settings - Fork 4
/
access_request.go
44 lines (33 loc) · 990 Bytes
/
access_request.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
35
36
37
38
39
40
41
42
43
44
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2
type AccessRequest struct {
GrantTypes Arguments `json:"grantTypes" gorethink:"grantTypes"`
HandledGrantType Arguments `json:"handledGrantType" gorethink:"handledGrantType"`
Request
}
func NewAccessRequest(session Session) *AccessRequest {
r := &AccessRequest{
GrantTypes: Arguments{},
HandledGrantType: Arguments{},
Request: *NewRequest(),
}
r.Session = session
return r
}
func (a *AccessRequest) GetGrantTypes() Arguments {
return a.GrantTypes
}
func (a *AccessRequest) SetGrantedScopes(scopes Arguments) {
a.GrantedScope = scopes
}
func (a *AccessRequest) SanitizeRestoreRefreshTokenOriginalRequester(requester Requester) Requester {
r := a.Sanitize(nil).(*Request)
ar := &AccessRequest{
Request: *r,
}
ar.SetID(requester.GetID())
ar.SetRequestedScopes(requester.GetRequestedScopes())
ar.SetGrantedScopes(requester.GetGrantedScopes())
return ar
}