init: 클린 기반 auth 서버 설계
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
{
|
||||
"info": {
|
||||
"_postman_id": "7f87f966-14d8-4ea0-bd6f-2a41d657aef2",
|
||||
"name": "project-auth-server resource-server",
|
||||
"description": "Keycloak access token 검증과 연결된 내부 사용자 조회 확인용 Postman 컬렉션",
|
||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||
},
|
||||
"item": [
|
||||
{
|
||||
"name": "현재 사용자 조회",
|
||||
"request": {
|
||||
"auth": {
|
||||
"type": "bearer",
|
||||
"bearer": [
|
||||
{
|
||||
"key": "token",
|
||||
"value": "{{keycloakAccessToken}}",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{baseUrl}}/api/v1/auth/me",
|
||||
"host": [
|
||||
"{{baseUrl}}"
|
||||
],
|
||||
"path": [
|
||||
"api",
|
||||
"v1",
|
||||
"auth",
|
||||
"me"
|
||||
]
|
||||
},
|
||||
"description": "Keycloak access token을 검증하고 이미 연결된 내부 users row를 provider=KEYCLOAK, provider_subject=sub 기준으로 조회합니다."
|
||||
},
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"pm.test('200 OK 반환', function () {",
|
||||
" pm.response.to.have.status(200);",
|
||||
"});",
|
||||
"",
|
||||
"pm.test('현재 사용자 응답 확인', function () {",
|
||||
" var json = pm.response.json();",
|
||||
" pm.expect(json.success).to.eql(true);",
|
||||
" pm.expect(json.code).to.eql('AUTHENTICATED_USER_LOADED');",
|
||||
" pm.expect(json.data.provider).to.eql('KEYCLOAK');",
|
||||
" pm.expect(json.data.subject).to.be.a('string').and.not.empty;",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Bearer token 없음",
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"header": [],
|
||||
"url": {
|
||||
"raw": "{{baseUrl}}/api/v1/auth/me",
|
||||
"host": [
|
||||
"{{baseUrl}}"
|
||||
],
|
||||
"path": [
|
||||
"api",
|
||||
"v1",
|
||||
"auth",
|
||||
"me"
|
||||
]
|
||||
},
|
||||
"description": "Authorization 헤더가 없을 때 resource server가 401을 반환하는지 확인합니다."
|
||||
},
|
||||
"event": [
|
||||
{
|
||||
"listen": "test",
|
||||
"script": {
|
||||
"type": "text/javascript",
|
||||
"exec": [
|
||||
"pm.test('401 Unauthorized 반환', function () {",
|
||||
" pm.response.to.have.status(401);",
|
||||
"});",
|
||||
"",
|
||||
"pm.test('인증 필요 에러 코드 확인', function () {",
|
||||
" var json = pm.response.json();",
|
||||
" pm.expect(json.success).to.eql(false);",
|
||||
" pm.expect(json.code).to.eql('AUTH-001');",
|
||||
"});"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"variable": [
|
||||
{
|
||||
"key": "baseUrl",
|
||||
"value": "http://localhost:8080"
|
||||
},
|
||||
{
|
||||
"key": "keycloakAccessToken",
|
||||
"value": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user