-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Swagger API 문서에 대한 보안 설정 (#138)
feat: Swagger API 문서에 대한 보안 설정 (#137)
- Loading branch information
1 parent
2a22cbe
commit 393674d
Showing
4 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...main/java/com/smunity/server/global/security/config/InMemoryUserDetailsManagerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.smunity.server.global.security.config; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.core.userdetails.User; | ||
import org.springframework.security.core.userdetails.UserDetails; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.security.provisioning.InMemoryUserDetailsManager; | ||
|
||
@Configuration | ||
@RequiredArgsConstructor | ||
public class InMemoryUserDetailsManagerConfig { | ||
|
||
private final SwaggerProperties swaggerProperties; | ||
private final PasswordEncoder passwordEncoder; | ||
|
||
@Bean | ||
public InMemoryUserDetailsManager inMemoryUserDetailsManager() { | ||
return new InMemoryUserDetailsManager(createUserDetails()); | ||
} | ||
|
||
private UserDetails createUserDetails() { | ||
return User.builder() | ||
.username(swaggerProperties.getUsername()) | ||
.password(passwordEncoder.encode(swaggerProperties.getPassword())) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/com/smunity/server/global/security/config/SwaggerProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.smunity.server.global.security.config; | ||
|
||
import lombok.Data; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
@ConfigurationProperties(prefix = "swagger") | ||
@Data | ||
public class SwaggerProperties { | ||
|
||
private String username; | ||
private String password; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters