/
oidc.go
106 lines (85 loc) · 1.76 KB
/
oidc.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package design
import (
. "goa.design/goa/v3/dsl"
)
var _ = Service("oidc", func() {
Error("user-unverified", func() {
})
Method("required", func() {
Payload(func() {
Attribute("token", String)
Attribute("follow", Boolean)
Attribute("after", String)
})
Result(func() {
Attribute("location", String)
Required("location")
})
HTTP(func() {
GET("oidc/required")
Header("token:Authorization", String, "authentication token", func() {
Pattern("^Bearer [^ ]+$")
})
Params(func() {
Param("after")
Param("follow")
})
Response(StatusTemporaryRedirect, func() {
Headers(func() {
Header("location:Location")
})
})
})
})
Method("url", func() {
Payload(func() {
Attribute("token", String)
Attribute("follow", Boolean)
Attribute("after", String)
})
Result(func() {
Attribute("location", String)
Required("location")
})
HTTP(func() {
GET("oidc/url")
Header("token:Authorization", String, "authentication token", func() {
Pattern("^Bearer [^ ]+$")
})
Params(func() {
Param("after")
Param("follow")
})
Response(StatusOK)
})
})
Method("authenticate", func() {
Payload(func() {
Attribute("state", String)
Required("state")
Attribute("session_state", String)
Required("session_state")
Attribute("code", String)
Required("code")
})
Result(func() {
Attribute("location", String)
Required("location")
Attribute("token", String)
Required("token")
Attribute("header", String)
Required("header")
})
HTTP(func() {
POST("oidc/auth")
Params(func() {
Param("state")
Param("session_state")
Param("code")
})
Response(StatusOK)
Response("user-unverified", StatusForbidden)
})
})
commonOptions()
})