forked from withinboredom/dapr-magic-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswagger.yaml
More file actions
122 lines (122 loc) · 3.22 KB
/
Copy pathswagger.yaml
File metadata and controls
122 lines (122 loc) · 3.22 KB
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
openapi: 3.0.0
info:
description: "An example auth service that allows sending a message to the user to authenticate"
version: 0.1.0
title: Magic Auth
servers:
- description: Docker Compose
url: http://localhost/
- description: Dapr
url: https://localhost:3500/v1.0/invoke/authService/method/
paths:
/start/{userId}/{deviceId}/{nonce}:
post:
summary: Start an auth session
description: Returns a code to send to the user
parameters:
- name: userId
in: path
description: A user identifier
required: true
schema:
type: string
- name: deviceId
in: path
description: A device address to send to
required: true
schema:
type: string
- name: nonce
in: path
description: A nonce
required: true
schema:
type: string
responses:
"200":
description: Successfully started the auth flow
content:
application/json:
schema:
type: string
description: The code to send to the device
"403":
description: Tried to restart an already started flow
/cancel/{userId}/{deviceId}:
post:
summary: Cancel an auth flow so it may be restarted
parameters:
- name: deviceId
in: path
description: The address to cancel
required: true
schema:
type: string
- name: userId
in: path
description: The user identifier
required: true
schema:
type: string
responses:
"200":
description: Success
/isAuthenticated/{userId}/{deviceId}/{nonce}:
get:
summary: Check if a user is authenticated
parameters:
- name: userId
in: path
description: The user identifier
required: true
schema:
type: string
- name: deviceId
in: path
description: The device address
required: true
schema:
type: string
- name: nonce
in: path
description: The nonce to check
required: true
schema:
type: string
responses:
"200":
description: Whether the user and nonce is authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/IsAuthenticated'
/authenticate/{userId}/{code}:
post:
summary: Authenticate a user
parameters:
- name: userId
in: path
description: The user identifier
required: true
schema:
type: string
- name: code
in: path
description: The code sent to the user
required: true
schema:
type: string
responses:
"200":
description: Successful request
content:
application/json:
schema:
$ref: '#/components/schemas/IsAuthenticated'
components:
schemas:
IsAuthenticated:
type: object
properties:
isAuthenticated:
type: boolean