-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from team-REDDI/dev
dev to main
- Loading branch information
Showing
15 changed files
with
174 additions
and
45 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
...ddiserver/security/config/CorsConfig.java → ...xample/reddiserver/config/CorsConfig.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
40 changes: 29 additions & 11 deletions
40
src/main/java/com/example/reddiserver/config/SwaggerConfig.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 |
---|---|---|
@@ -1,31 +1,49 @@ | ||
package com.example.reddiserver.config; | ||
|
||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; | ||
import io.swagger.v3.oas.annotations.security.SecurityScheme; | ||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import io.swagger.v3.oas.models.servers.Server; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Profile; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Configuration | ||
@SecurityScheme( | ||
name = "Authorization", | ||
type = SecuritySchemeType.HTTP, | ||
bearerFormat = "JWT", | ||
scheme = "bearer" | ||
) | ||
public class SwaggerConfig { | ||
private static final String SECURITY_SCHEME_NAME = "authorization"; // 추가 | ||
|
||
@Bean | ||
@Profile("local") | ||
public OpenAPI localOpenAPIBuilder() { | ||
return new OpenAPI().addServersItem(new Server().url("http://localhost:8080")); | ||
} | ||
|
||
@Bean | ||
@Profile("dev") | ||
public OpenAPI devOpenAPIBuilder() { | ||
return new OpenAPI().addServersItem(new Server().url("https://api.reddi.kr")); | ||
} | ||
@Bean | ||
public OpenAPI openAPI() { | ||
Info info = new Info() | ||
.title("API Document") | ||
.version("v0.0.1") | ||
.description("REDDI API 명세서"); | ||
.title("API Document") | ||
.version("v0.0.1") | ||
.description("REDDI API 명세서"); | ||
return new OpenAPI() | ||
.components(new Components() | ||
.addSecuritySchemes(SECURITY_SCHEME_NAME, new SecurityScheme() | ||
.name(SECURITY_SCHEME_NAME) | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT"))) | ||
.addSecurityItem(new SecurityRequirement().addList(SECURITY_SCHEME_NAME)) | ||
.components(new Components()) | ||
.info(info); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...er/security/config/WebSecurityConfig.java → ...reddiserver/config/WebSecurityConfig.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
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
22 changes: 22 additions & 0 deletions
22
src/main/java/com/example/reddiserver/dto/auth/response/UserInfoResponseDto.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,22 @@ | ||
package com.example.reddiserver.dto.auth.response; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class UserInfoResponseDto { | ||
private Long userId; | ||
private String name; | ||
private String email; | ||
private String profileImageUrl; | ||
|
||
public static UserInfoResponseDto from(Long userId, String name, String email, String profileImageUrl) { | ||
UserInfoResponseDto userInfoResponseDto = new UserInfoResponseDto(); | ||
userInfoResponseDto.setUserId(userId); | ||
userInfoResponseDto.setName(name); | ||
userInfoResponseDto.setEmail(email); | ||
userInfoResponseDto.setProfileImageUrl(profileImageUrl); | ||
return userInfoResponseDto; | ||
} | ||
} |
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
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
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
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
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
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
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
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
Oops, something went wrong.