-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpushed_authorize_response.go
66 lines (52 loc) · 1.43 KB
/
pushed_authorize_response.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package oauth2
import (
"net/http"
"authelia.com/provider/oauth2/internal/consts"
)
// PushedAuthorizeResponse is the response object for PAR
type PushedAuthorizeResponse struct {
RequestURI string `json:"request_uri"`
ExpiresIn int `json:"expires_in"`
Header http.Header
Extra map[string]any
}
// GetRequestURI gets
func (a *PushedAuthorizeResponse) GetRequestURI() string {
return a.RequestURI
}
// SetRequestURI sets
func (a *PushedAuthorizeResponse) SetRequestURI(requestURI string) {
a.RequestURI = requestURI
}
// GetExpiresIn gets
func (a *PushedAuthorizeResponse) GetExpiresIn() int {
return a.ExpiresIn
}
// SetExpiresIn sets
func (a *PushedAuthorizeResponse) SetExpiresIn(seconds int) {
a.ExpiresIn = seconds
}
// GetHeader gets
func (a *PushedAuthorizeResponse) GetHeader() http.Header {
return a.Header
}
// AddHeader adds
func (a *PushedAuthorizeResponse) AddHeader(key, value string) {
a.Header.Add(key, value)
}
// SetExtra sets
func (a *PushedAuthorizeResponse) SetExtra(key string, value any) {
a.Extra[key] = value
}
// GetExtra gets
func (a *PushedAuthorizeResponse) GetExtra(key string) any {
return a.Extra[key]
}
// ToMap converts to a map
func (a *PushedAuthorizeResponse) ToMap() map[string]any {
a.Extra[consts.FormParameterRequestURI] = a.RequestURI
a.Extra[consts.AccessResponseExpiresIn] = a.ExpiresIn
return a.Extra
}