-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
199 lines (199 loc) · 6.06 KB
/
openapi.yaml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
openapi: 3.0.0
info:
description: Authentication based in Openstack Keystone
version: 1.0.0
title: OSM Keystone Authentication
contact:
email: eduardosousa@av.it.pt
license:
name: GNU General Public License v3.0
url: https://www.gnu.org/licenses/gpl-3.0-standalone.html
paths:
/auth:
get:
summary: Validate token
description: This endpoint is used to check if a token is valid and get the associated information.
parameters:
- in: header
name: X-Service-Token
description: Token that belongs to the service trying to validate
schema:
type: string
required: true
- in: header
name: X-Subject-Token
description: Token to be validated
schema:
type: string
required: true
- in: header
name: X-External-Token
description: External token that represents the user in another system
schema:
type: string
required: false
responses:
200:
description: Token is valid
content:
application/json:
schema:
$ref: '#/components/schemas/Subject'
400:
description: |
service token must be provided
validation must be done by service user
403:
description: external token not authenticated
404:
description: subject token not found
head:
summary: Validate token
description: This endpoint is used to check if a token is valid.
parameters:
- in: header
name: X-Service-Token
description: Token that belongs to the service trying to validate
schema:
type: string
required: true
- in: header
name: X-Subject-Token
description: Token to be validated
schema:
type: string
required: true
- in: header
name: X-External-Token
description: External token that represents the user in another system
schema:
type: string
required: false
responses:
200:
description: token is valid
400:
description: |
service token must be provided
validation must be done by service user
403:
description: external token not authenticated
404:
description: subject token not found
post:
summary: Authenticate service or subject
description: |
This endpoint is used to authenticate subjects and services. A service can authenticate itself. A subject must be authenticated by a service, therefore a service token must be passed.
Authentication can also be done using valid tokens. In this case an old valid token can be used to obtain a new one.
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/BasicAuthRequest'
- $ref: '#/components/schemas/TokenAuthRequest'
parameters:
- in: header
name: X-Service-Token
description: Token that belongs to the service authenticating the subject. Only required if authenticating a subject.
schema:
type: string
required: false
responses:
405:
description: Invalid input
delete:
summary: Revoke token
description: This endpoint is used to revoke tokens.
parameters:
- in: header
name: X-Service-Token
description: Token that belongs to the service revoking a token
schema:
type: string
required: true
- in: header
name: X-Subject-Token
description: Token to be revoked
schema:
type: string
required: true
responses:
204:
description: token revoked
400:
description: |
service token must be provided
revoking must be done by service user
subject token must be provided
token could not be revoked
components:
schemas:
Subject:
type: object
properties:
username:
type: string
description: username associated with the token
projects:
type: array
items:
type: string
description: projects associated with the token
is_authenticated:
type: boolean
description: is the subject authenticated
is_enabled:
type: boolean
description: is the user associated with any project
issued_at:
type: string
format: date-time
description: timestamp when the token was issued
expires_at:
type: string
format: date-time
description: timestamp when the token will expire
required:
- username
- projects
- is_authenticated
- is_enabled
- issued_at
- expires_at
BasicAuthRequest:
type: object
properties:
method:
type: string
description: method defining what authentication is being performed
enum: [password]
external_token:
type: string
description: external token used to verify external identity
username:
type: string
description: username that identifies subject
password:
type: string
description: password that authenticates subject
required:
- method
- username
- password
TokenAuthRequest:
type: object
properties:
method:
type: string
description: method defining what authentication is being performed
enum: [token]
token:
type: string
description: token that identifies subject
external_token:
type: string
description: external token used to verify external identity
required:
- method
- token