1 package org.springframework.security.oauth.provider;
2
3 import org.springframework.security.authentication.AbstractAuthenticationToken;
4 import org.springframework.security.core.Authentication;
5 import org.springframework.security.oauth.provider.token.OAuthAccessProviderToken;
6
7 import javax.servlet.http.HttpServletRequest;
8
9
10
11
12
13
14 public class DefaultAuthenticationHandler implements OAuthAuthenticationHandler {
15
16
17
18
19
20
21
22
23
24
25
26 public Authentication createAuthentication(HttpServletRequest request, ConsumerAuthentication authentication, OAuthAccessProviderToken authToken) {
27 if (authToken != null) {
28 Authentication userAuthentication = authToken.getUserAuthentication();
29 if (userAuthentication instanceof AbstractAuthenticationToken) {
30
31 ((AbstractAuthenticationToken) userAuthentication).setDetails(new OAuthAuthenticationDetails(request, authentication.getConsumerDetails()));
32 }
33 return userAuthentication;
34 }
35
36 return authentication;
37 }
38 }