test(better auth): implementation start of better auth
This commit is contained in:
19
LogisticsSupportTool_API_DOCS/app/auth/Auth Me.bru
Normal file
19
LogisticsSupportTool_API_DOCS/app/auth/Auth Me.bru
Normal file
@@ -0,0 +1,19 @@
|
||||
meta {
|
||||
name: Auth Me
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://{{url}}/lst/api/me
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
headers {
|
||||
Cookie: {{session_cookie}}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
24
LogisticsSupportTool_API_DOCS/app/auth/Register.bru
Normal file
24
LogisticsSupportTool_API_DOCS/app/auth/Register.bru
Normal file
@@ -0,0 +1,24 @@
|
||||
meta {
|
||||
name: Register
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://{{url}}/lst/api/register
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"username":"matthes01",
|
||||
"name":"blake",
|
||||
"email":"blake.matthes@alpla.com",
|
||||
"password":"nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
35
LogisticsSupportTool_API_DOCS/app/auth/Sign-In - email.bru
Normal file
35
LogisticsSupportTool_API_DOCS/app/auth/Sign-In - email.bru
Normal file
@@ -0,0 +1,35 @@
|
||||
meta {
|
||||
name: Sign-In - email
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://{{url}}/lst/api/auth/sign-in/email
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"email": "blake.matthes@alpla.com",
|
||||
"password": "nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// grab the raw Set-Cookie header
|
||||
const cookies = res.headers["set-cookie"];
|
||||
|
||||
// cookies is usually an array, e.g. ["auth_session=abcd123; Path=/; HttpOnly; Secure; SameSite=Lax"]
|
||||
|
||||
// Extract just the value part ("auth_session=abcd123")
|
||||
const sessionCookie = cookies[0].split(";")[0];
|
||||
|
||||
// Save it as an environment variable
|
||||
bru.setEnvVar("session_cookie", sessionCookie);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
meta {
|
||||
name: Sign-In - username
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://{{url}}/lst/api/auth/sign-in/username
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"username": "matthes01",
|
||||
"password": "nova0511"
|
||||
}
|
||||
}
|
||||
|
||||
script:post-response {
|
||||
// grab the raw Set-Cookie header
|
||||
const cookies = res.headers["set-cookie"];
|
||||
|
||||
// cookies is usually an array, e.g. ["auth_session=abcd123; Path=/; HttpOnly; Secure; SameSite=Lax"]
|
||||
|
||||
// Extract just the value part ("auth_session=abcd123")
|
||||
const sessionCookie = cookies[0].split(";")[0];
|
||||
|
||||
// Save it as an environment variable
|
||||
bru.setEnvVar("session_cookie", sessionCookie);
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
}
|
||||
8
LogisticsSupportTool_API_DOCS/app/auth/folder.bru
Normal file
8
LogisticsSupportTool_API_DOCS/app/auth/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
||||
meta {
|
||||
name: auth
|
||||
seq: 1
|
||||
}
|
||||
|
||||
auth {
|
||||
mode: inherit
|
||||
}
|
||||
Reference in New Issue
Block a user