minauthator/tests/hurl_integration/scenarios/authorizations_management/main.hurl

53 lines
1.4 KiB
Text
Raw Normal View History

# Login into account
POST {{ base_url }}/login
[FormParams]
login: root
password: root
HTTP 303
[Captures]
user_jwt: cookie "minauthator_jwt"
[Asserts]
cookie "minauthator_jwt" exists
cookie "minauthator_jwt[Value]" contains "eyJ0"
cookie "minauthator_jwt[SameSite]" == "Lax"
# Assert that we have currently no authorizations
GET {{ base_url }}/me/authorizations
HTTP 200
[Asserts]
xpath "string(///h1)" == "Your authorizations"
xpath "string(///i)" == "You didn't authorized or accessed any applications for now."
# OAuth2 implicit flow (pre-granted app)
GET {{ base_url }}/authorize
[QueryStringParams]
client_id: 00000001-0000-0000-0000-000000000001
response_type: code
redirect_uri: http://localhost:9090/callback
state: Afk4kf6pbZkms78jM
scope: user_read_basic
HTTP 302
[Captures]
authorization_code: header "Location" regex "\\?code=(.*)&"
# OAuth2 get access token
POST {{ base_url }}/api/token
[BasicAuth]
00000001-0000-0000-0000-000000000001: dummy_client_secret
[FormParams]
code: {{ authorization_code }}
scope: user_read_basic
redirect_uri: http://localhost:9090/callback
grant_type: authorization_code
HTTP 200
[Captures]
access_token: jsonpath "$.access_token"
# Asserts that the new authorization is listed
GET {{ base_url }}/me/authorizations
HTTP 200
[Asserts]
xpath "string(///h1)" == "Your authorizations"
xpath "string(///main/ul/li)" contains "UserReadBasic"