Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
extract accountId from User set as "user" property at session scope
package org.example;
import java.io.Serializable;
import org.springframework.social.web.connect.AccountIdExtractor;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.WebRequest;
// your own User class
import org.example.User;
/**
* extract accountId from User set as "user" property at session scope
*/
public class UserAccountIdExtractor implements AccountIdExtractor {
@Override
public Serializable extractAccountId(final WebRequest request) {
User user = (User) request.getAttribute("user", RequestAttributes.SCOPE_SESSION);
return user == null ? null : user.getId();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.