인증/권한 저위험 파일 Spring 전환 스파이크 #7
9 changed files with 123 additions and 0 deletions
3
.forge/BAIS-SPRING-DEV-AUTH-001-attempt-1.md
Normal file
3
.forge/BAIS-SPRING-DEV-AUTH-001-attempt-1.md
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
# BAIS-SPRING-DEV-AUTH-001-attempt-1
|
||||||
|
|
||||||
|
Forge 이슈 작업 브랜치 `forge/BAIS-SPRING-DEV-AUTH-001-attempt-1`.
|
||||||
23
src/main/java/com/example/authentication/Sau02f220uDto.java
Normal file
23
src/main/java/com/example/authentication/Sau02f220uDto.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.example.authentication;
|
||||||
|
|
||||||
|
public class Sau02f220uDto {
|
||||||
|
private String username;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.authentication;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class Sau02f220uRepository {
|
||||||
|
public void save(Sau02f220uDto dto) {
|
||||||
|
// Save logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.authentication;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Sau02f220uService {
|
||||||
|
public void authenticate(Sau02f220uDto dto) {
|
||||||
|
// Authentication logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/main/java/com/example/authorization/Maz02f116rDto.java
Normal file
23
src/main/java/com/example/authorization/Maz02f116rDto.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.example.authorization;
|
||||||
|
|
||||||
|
public class Maz02f116rDto {
|
||||||
|
private String role;
|
||||||
|
private String permissions;
|
||||||
|
|
||||||
|
// Getters and Setters
|
||||||
|
public String getRole() {
|
||||||
|
return role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRole(String role) {
|
||||||
|
this.role = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPermissions() {
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(String permissions) {
|
||||||
|
this.permissions = permissions;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.authorization;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class Maz02f116rRepository {
|
||||||
|
public void save(Maz02f116rDto dto) {
|
||||||
|
// Save logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.example.authorization;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class Maz02f116rService {
|
||||||
|
public void authorize(Maz02f116rDto dto) {
|
||||||
|
// Authorization logic here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.example.authentication;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
class Sau02f220uServiceTest {
|
||||||
|
@Test
|
||||||
|
void testAuthenticate() {
|
||||||
|
Sau02f220uService service = new Sau02f220uService();
|
||||||
|
Sau02f220uDto dto = new Sau02f220uDto();
|
||||||
|
dto.setUsername("testUser");
|
||||||
|
dto.setPassword("testPass");
|
||||||
|
|
||||||
|
service.authenticate(dto);
|
||||||
|
// Add assertions here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.example.authorization;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import static org.mockito.Mockito.*;
|
||||||
|
|
||||||
|
class Maz02f116rServiceTest {
|
||||||
|
@Test
|
||||||
|
void testAuthorize() {
|
||||||
|
Maz02f116rService service = new Maz02f116rService();
|
||||||
|
Maz02f116rDto dto = new Maz02f116rDto();
|
||||||
|
dto.setRole("admin");
|
||||||
|
dto.setPermissions("read, write");
|
||||||
|
|
||||||
|
service.authorize(dto);
|
||||||
|
// Add assertions here
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue