@@ -4,6 +4,7 @@ import org.gitanimals.identity.app.AppleLoginFacade
4
4
import org.gitanimals.identity.app.GithubLoginFacade
5
5
import org.gitanimals.identity.controller.request.AppleLoginRequest
6
6
import org.gitanimals.identity.controller.request.RedirectWhenSuccess
7
+ import org.gitanimals.identity.controller.response.TokenResponse
7
8
import org.springframework.beans.factory.annotation.Value
8
9
import org.springframework.http.HttpStatus
9
10
import org.springframework.http.ResponseEntity
@@ -48,22 +49,17 @@ class Oauth2Controller(
48
49
}
49
50
50
51
@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 (
56
54
@RequestHeader(name = " Login-Secret" ) loginSecret : String ,
57
55
@RequestBody appleLoginRequest : AppleLoginRequest ,
58
- ): ResponseEntity < Unit > {
56
+ ): TokenResponse {
59
57
val token = appleLoginFacade.login(
60
58
username = appleLoginRequest.name,
61
59
profileImage = appleLoginRequest.profileImage,
62
60
loginSecret = loginSecret,
63
61
)
64
62
65
- return ResponseEntity .status(HttpStatus .TEMPORARY_REDIRECT )
66
- .header(" Location" , redirectWhenSuccess.successUriWithToken(token))
67
- .build()
63
+ return TokenResponse (token)
68
64
}
69
65
}
0 commit comments