BAIS 권한 서비스를 Spring Java로 전환 #1
4 changed files with 76 additions and 0 deletions
3
.forge/BAIS-RECOVERY-MIG-001-attempt-1.md
Normal file
3
.forge/BAIS-RECOVERY-MIG-001-attempt-1.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# BAIS-RECOVERY-MIG-001-attempt-1
|
||||
|
||||
Forge 이슈 작업 브랜치 `forge/BAIS-RECOVERY-MIG-001-attempt-1`.
|
||||
48
pom.xml
Normal file
48
pom.xml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>bais-authorization-service</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.example.authorization;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AuthorizationService {
|
||||
public boolean hasAccess(String userRole, String resource) {
|
||||
// Simple access control logic
|
||||
return "ADMIN".equals(userRole);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.example.authorization;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class AuthorizationServiceTest {
|
||||
|
||||
@Test
|
||||
void testHasAccess() {
|
||||
AuthorizationService service = new AuthorizationService();
|
||||
assertTrue(service.hasAccess("ADMIN", "someResource"));
|
||||
assertFalse(service.hasAccess("USER", "someResource"));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue