...
1
21
22 package fosite
23
24 import (
25 "html/template"
26 "net/http"
27 "reflect"
28
29 "github.com/ory/fosite/i18n"
30 )
31
32
33 type AuthorizeEndpointHandlers []AuthorizeEndpointHandler
34
35
36 func (a *AuthorizeEndpointHandlers) Append(h AuthorizeEndpointHandler) {
37 for _, this := range *a {
38 if reflect.TypeOf(this) == reflect.TypeOf(h) {
39 return
40 }
41 }
42
43 *a = append(*a, h)
44 }
45
46
47 type TokenEndpointHandlers []TokenEndpointHandler
48
49
50 func (t *TokenEndpointHandlers) Append(h TokenEndpointHandler) {
51 for _, this := range *t {
52 if reflect.TypeOf(this) == reflect.TypeOf(h) {
53 return
54 }
55 }
56
57 *t = append(*t, h)
58 }
59
60
61 type TokenIntrospectionHandlers []TokenIntrospector
62
63
64 func (t *TokenIntrospectionHandlers) Append(h TokenIntrospector) {
65 for _, this := range *t {
66 if reflect.TypeOf(this) == reflect.TypeOf(h) {
67 return
68 }
69 }
70
71 *t = append(*t, h)
72 }
73
74
75 type RevocationHandlers []RevocationHandler
76
77
78 func (t *RevocationHandlers) Append(h RevocationHandler) {
79 for _, this := range *t {
80 if reflect.TypeOf(this) == reflect.TypeOf(h) {
81 return
82 }
83 }
84
85 *t = append(*t, h)
86 }
87
88
89 type Fosite struct {
90 Store Storage
91 AuthorizeEndpointHandlers AuthorizeEndpointHandlers
92 TokenEndpointHandlers TokenEndpointHandlers
93 TokenIntrospectionHandlers TokenIntrospectionHandlers
94 RevocationHandlers RevocationHandlers
95 Hasher Hasher
96 ScopeStrategy ScopeStrategy
97 AudienceMatchingStrategy AudienceMatchingStrategy
98 JWKSFetcherStrategy JWKSFetcherStrategy
99 HTTPClient *http.Client
100 UseLegacyErrorFormat bool
101
102
103 TokenURL string
104
105
106
107
108 SendDebugMessagesToClients bool
109
110
111 MinParameterEntropy int
112
113
114 FormPostHTMLTemplate *template.Template
115
116
117 ClientAuthenticationStrategy ClientAuthenticationStrategy
118
119 ResponseModeHandlerExtension ResponseModeHandler
120
121
122 MessageCatalog i18n.MessageCatalog
123 }
124
125 const MinParameterEntropy = 8
126
127
128 func (f *Fosite) GetMinParameterEntropy() int {
129 if f.MinParameterEntropy == 0 {
130 return MinParameterEntropy
131 } else {
132 return f.MinParameterEntropy
133 }
134 }
135
136 var defaultResponseModeHandler = &DefaultResponseModeHandler{}
137
138 func (f *Fosite) ResponseModeHandler() ResponseModeHandler {
139 if f.ResponseModeHandlerExtension == nil {
140 return defaultResponseModeHandler
141 }
142 return f.ResponseModeHandlerExtension
143 }
144
View as plain text