-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapi-demo.http
103 lines (77 loc) · 2.45 KB
/
api-demo.http
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
# Obtain an OTP token (and send OTP)
POST http://localhost:8081/oauth/token
Authorization: Basic mobile-client secret
Content-Type: application/x-www-form-urlencoded
grant_type=otp&phone_number=123456789
> {%
var otpToken = response.body.otp_token;
client.global.set("otpToken", otpToken);
client.test("Obtain a short-living token for OTP", function() {
client.assert(response.status === 403, "Response status is 403");
});
%}
###
# Exchange OTP for a regular tokens
POST http://localhost:8081/oauth/token
Authorization: Basic mobile-client secret
Content-Type: application/x-www-form-urlencoded
grant_type=otp&otp=123456&scope=api&otp_token={{otpToken}}
> {%
var accessToken = response.body.access_token;
client.global.set("accessToken", accessToken);
var refreshToken = response.body.refresh_token;
client.global.set("refreshToken", refreshToken);
client.test("Exchange OTP for regular tokens", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###
# Get some resources
GET http://localhost:8082/api/resources
Authorization: Bearer {{accessToken}}
Accept: application/json
> {%
client.test("Get some resources", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###
# Refresh regular tokens
POST http://localhost:8081/oauth/token
Authorization: Basic mobile-client secret
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token&scope=api&refresh_token={{refreshToken}}
> {%
var accessToken = response.body.access_token;
client.global.set("accessToken", accessToken);
var refreshToken = response.body.refresh_token;
client.global.set("refreshToken", refreshToken);
client.test("Refresh regular tokens", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###
# Auth-service health check
GET http://localhost:8081/actuator/health
> {%
client.test("Auth-service health check", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###
# Resource-service health check
GET http://localhost:8082/actuator/health
> {%
client.test("Auth-service health check", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###
# JWK set access
GET http://localhost:8081/.well-known/jwks.json
> {%
client.test("Check JWK set endpoint access", function() {
client.assert(response.status === 200, "Response status is 200");
});
%}
###