kompAC
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
❯ grpcurl -plaintext -d '{
|
||||
"username": "testuser2",
|
||||
"email": "test2@example.com"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
{
|
||||
"id": "5fa9bbce-85e0-4b06-8364-b561770c2fdd",
|
||||
"username": "testuser2",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"email": "test3@example.com",
|
||||
"password": "your_password",
|
||||
"password_confirmation": "your_password"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
{
|
||||
"id": "96d2fd35-b39d-4c05-916a-66134453d34c",
|
||||
"username": "testuser3",
|
||||
@@ -12,14 +12,14 @@
|
||||
}
|
||||
❯ grpcurl -plaintext -d '{
|
||||
"identifier": "testuser3"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Login
|
||||
}' localhost:50051 KompAC.auth.AuthService/Login
|
||||
ERROR:
|
||||
Code: Unauthenticated
|
||||
Message: Invalid credentials
|
||||
❯ grpcurl -plaintext -d '{
|
||||
"identifier": "testuser3",
|
||||
"password": "your_password"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Login
|
||||
}' localhost:50051 KompAC.auth.AuthService/Login
|
||||
{
|
||||
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI5NmQyZmQzNS1iMzlkLTRjMDUtOTE2YS02NjEzNDQ1M2QzNGMiLCJleHAiOjE3NDI5ODE2MTAsInJvbGUiOiJhY2NvdW50YW50In0.78VIR3X4QZohzeI5x3xmkmqcICTusOC6PELPohMV-k8",
|
||||
"tokenType": "Bearer",
|
||||
@@ -30,7 +30,7 @@ ERROR:
|
||||
❯ grpcurl -plaintext -d '{
|
||||
"username": "testuser4",
|
||||
"email": "test4@example.com"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
{
|
||||
"id": "413d7ecc-f231-48af-8c5a-566b1dc2bf0b",
|
||||
"username": "testuser4",
|
||||
@@ -39,7 +39,7 @@ ERROR:
|
||||
}
|
||||
❯ grpcurl -plaintext -d '{
|
||||
"identifier": "test4@example.com"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Login
|
||||
}' localhost:50051 KompAC.auth.AuthService/Login
|
||||
{
|
||||
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI0MTNkN2VjYy1mMjMxLTQ4YWYtOGM1YS01NjZiMWRjMmJmMGIiLCJleHAiOjE3NDI5ODE3MDEsInJvbGUiOiJhY2NvdW50YW50In0.4Hzu3tTZRNGHnBSgeCbGy2tFTl8EzpPdXBhcW8kuIc8",
|
||||
"tokenType": "Bearer",
|
||||
@@ -47,5 +47,5 @@ ERROR:
|
||||
"userId": "413d7ecc-f231-48af-8c5a-566b1dc2bf0b",
|
||||
"role": "accountant"
|
||||
}
|
||||
╭─ ~/Doc/pr/multieko2/server auth ······ ✔
|
||||
╭─ ~/Doc/pr/KompAC/server auth ······ ✔
|
||||
╰─
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"email": "default@example.com",
|
||||
"password": "password",
|
||||
"password_confirmation": "password"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
{
|
||||
"id": "73017288-af41-49d8-b4cb-2ac2109b38a1",
|
||||
"username": "testuser_default_role",
|
||||
@@ -16,7 +16,7 @@
|
||||
"password": "password",
|
||||
"password_confirmation": "password",
|
||||
"role": "admin"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
{
|
||||
"id": "9437e318-818b-4c34-822d-c2d6601b835e",
|
||||
"username": "testuser_admin_role",
|
||||
@@ -29,9 +29,9 @@
|
||||
"password": "password",
|
||||
"password_confirmation": "password",
|
||||
"role": "invalid_role_name"
|
||||
}' localhost:50051 multieko2.auth.AuthService/Register
|
||||
}' localhost:50051 KompAC.auth.AuthService/Register
|
||||
ERROR:
|
||||
Code: InvalidArgument
|
||||
Message: Invalid role specified: 'invalid_role_name'
|
||||
╭─ ~/Doc/pr/multieko2/server main +3 !1
|
||||
╭─ ~/Doc/pr/KompAC/server main +3 !1
|
||||
╰─
|
||||
|
||||
@@ -3,7 +3,7 @@ use bcrypt::verify;
|
||||
use tonic::{Response, Status};
|
||||
use crate::db::PgPool;
|
||||
use crate::auth::logic::jwt; // Fixed import path
|
||||
use common::proto::multieko2::auth::{LoginRequest, LoginResponse};
|
||||
use common::proto::KompAC::auth::{LoginRequest, LoginResponse};
|
||||
|
||||
pub async fn login(
|
||||
pool: &PgPool,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/auth/handlers/register.rs
|
||||
use bcrypt::{hash, DEFAULT_COST};
|
||||
use tonic::{Response, Status};
|
||||
use common::proto::multieko2::auth::{RegisterRequest, AuthResponse};
|
||||
use common::proto::KompAC::auth::{RegisterRequest, AuthResponse};
|
||||
use crate::db::PgPool;
|
||||
use crate::auth::models::AuthError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user