pwheel / spring-security-oauth2-client

An OAuth2 client implementation for Spring Security that allows you to use an OAuth2 Provider (such as DailyCred) directly as an Authentication Provider
MIT License
16 stars 32 forks source link

question regarding the postCreated service #6

Closed gpinkham closed 8 years ago

gpinkham commented 8 years ago

in the comments you mention: "For example they could set something in the session so that the authentication success handler can treat the first log in differently."

could just be my rust (6 years away from spring and java) but how would one get the session in that service class?

thanks!

pwheel commented 8 years ago

Hi, Yeah, good question. It's a little naughty in my opinion, but Spring allows you to inject the HttpServletRequest; you can just autowire it as normal. Spring proxies it and magically gives you the HttpServletRequest for the current request. So you can use that to obtain the session from HttpServletRequest. :)