Skip to content

Commit 7449a67

Browse files
authored
release: 1.6.0 (#173)
2 parents 0ba2f7d + d47a263 commit 7449a67

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

docs/api/identity/login-apple.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
### HTTP METHOD : `POST`
55
### url : `https://api.gitanimals.org/logins/oauth/apple`
66
### Header
7-
- Redirect-When-Success : `HOME`, `ADMIN`, `LOCAL`, `LOCAL_ADMIN` 중 하나를 입력해주세요. HOME은 로그인 성공시 홈페이지로 로그인, ADMIN은 로그인 성공시 어드민 페이지로 리다이렉트 됩니다. LOCAL은 `http://localhost:3000?jwt={jwt}` 로 리다이렉트 됩니다.
87
- Login-Secret: 내부 로그인 토큰을 전달 하세요.
98

109
### Request Body
@@ -16,8 +15,9 @@
1615
```
1716

1817
# Response
19-
로그인 성공시 등록한 url로 jwt를 전달합니다.
20-
ADMIN : `https://admin.gitanimals.org?jwt={jwtToken}`
21-
HOME : `https://www.gitanimals.org?jwt={jwtToken}`
22-
LOCAL : `http://localhost:3000?jwt={jwtToken}`
23-
LOCAL_ADMIN : `http://localhost:5173?jwt={jwtToken}`
18+
19+
```json
20+
{
21+
"token": "bearer ..."
22+
}
23+
```

src/main/kotlin/org/gitanimals/identity/controller/Oauth2Controller.kt

+5-9
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import org.gitanimals.identity.app.AppleLoginFacade
44
import org.gitanimals.identity.app.GithubLoginFacade
55
import org.gitanimals.identity.controller.request.AppleLoginRequest
66
import org.gitanimals.identity.controller.request.RedirectWhenSuccess
7+
import org.gitanimals.identity.controller.response.TokenResponse
78
import org.springframework.beans.factory.annotation.Value
89
import org.springframework.http.HttpStatus
910
import org.springframework.http.ResponseEntity
@@ -48,22 +49,17 @@ class Oauth2Controller(
4849
}
4950

5051
@PostMapping("/logins/oauth/apple")
51-
fun loginWithAppleAndRedirect(
52-
@RequestHeader(
53-
name = "Redirect-When-Success",
54-
defaultValue = "HOME"
55-
) redirectWhenSuccess: RedirectWhenSuccess,
52+
@ResponseStatus(HttpStatus.OK)
53+
fun loginWithApple(
5654
@RequestHeader(name = "Login-Secret") loginSecret: String,
5755
@RequestBody appleLoginRequest: AppleLoginRequest,
58-
): ResponseEntity<Unit> {
56+
): TokenResponse {
5957
val token = appleLoginFacade.login(
6058
username = appleLoginRequest.name,
6159
profileImage = appleLoginRequest.profileImage,
6260
loginSecret = loginSecret,
6361
)
6462

65-
return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT)
66-
.header("Location", redirectWhenSuccess.successUriWithToken(token))
67-
.build()
63+
return TokenResponse(token)
6864
}
6965
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.gitanimals.identity.controller.response
2+
3+
data class TokenResponse(
4+
val token: String,
5+
)

0 commit comments

Comments
 (0)