Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ import org.apache.commons.codec.binary.Base64
import org.grails.plugins.codecs.URLCodec
import org.pac4j.core.client.IndirectClient
import org.pac4j.core.context.CallContext
import org.pac4j.core.context.WebContext
import org.pac4j.core.exception.http.RedirectionAction
import org.pac4j.jee.context.JEEContext
import org.pac4j.jee.context.session.JEESessionStore
import org.pac4j.jee.context.session.JEESessionStoreFactory
import org.springframework.http.HttpStatus
import org.springframework.security.core.userdetails.User

Expand Down Expand Up @@ -64,8 +63,6 @@ class RestOauthController {
*/
def authenticate(String provider, String callback) {
IndirectClient client = restOauthService.getClient(provider)
WebContext context = new JEEContext(request, response)

if (callback) {
try {
if (Base64.isBase64(callback.getBytes())){
Expand All @@ -78,7 +75,8 @@ class RestOauthController {
}
}

RedirectionAction redirectAction = client.getRedirectionAction(context, JEESessionStore.INSTANCE).get()
RedirectionAction redirectAction = client.getRedirectionAction(new CallContext(new JEEContext(request, response),
JEESessionStoreFactory.INSTANCE.newSessionStore(null))).get()
log.debug "Redirecting to ${redirectAction.location}"
redirect url: redirectAction.location
}
Expand All @@ -89,7 +87,8 @@ class RestOauthController {
* frontend application can store the REST API token locally for subsequent API calls.
*/
def callback(String provider) {
CallContext context = new CallContext(new JEEContext(request, response), null)
CallContext context = new CallContext(new JEEContext(request, response),
JEESessionStoreFactory.INSTANCE.newSessionStore(null))
def frontendCallbackUrl
if (session[CALLBACK_ATTR]) {
log.debug "Found callback URL in the HTTP session"
Expand Down
Loading