-
Notifications
You must be signed in to change notification settings - Fork 368
/
Copy pathdevice_request.go
43 lines (35 loc) · 968 Bytes
/
device_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
// Copyright © 2025 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package fosite
type UserCodeState int16
const (
// User code is active
UserCodeUnused = UserCodeState(0)
// User code has been accepted
UserCodeAccepted = UserCodeState(1)
// User code has been rejected
UserCodeRejected = UserCodeState(2)
)
// DeviceRequest is an implementation of DeviceRequester
type DeviceRequest struct {
UserCodeState UserCodeState
Request
}
func (d *DeviceRequest) GetUserCodeState() UserCodeState {
return d.UserCodeState
}
func (d *DeviceRequest) SetUserCodeState(state UserCodeState) {
d.UserCodeState = state
}
func (d *DeviceRequest) Sanitize(allowedParameters []string) Requester {
r, _ := d.Request.Sanitize(allowedParameters).(*Request)
d.Request = *r
return d
}
// NewDeviceRequest returns a new device request
func NewDeviceRequest() *DeviceRequest {
return &DeviceRequest{
UserCodeState: UserCodeUnused,
Request: *NewRequest(),
}
}