TENCENT_IOA
This commit is contained in:
@@ -124,5 +124,8 @@ public class OAuth2Constants {
|
||||
|
||||
public final static String ENDPOINT_OPENID_CONNECT_USERINFO = "/api/connect/v10/userinfo";
|
||||
|
||||
public final static String ENDPOINT_TENCENT_IOA_AUTHORIZE = "/oauth2/authorize";
|
||||
public final static String ENDPOINT_TENCENT_IOA_TOKEN = "/oauth2/token";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,11 @@ public class AuthorizationEndpoint extends AbstractEndpoint {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "OAuth 2.0 认证接口", notes = "传递参数client_id,response_type,redirect_uri等",httpMethod="GET")
|
||||
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_AUTHORIZE, method = RequestMethod.GET)
|
||||
@RequestMapping(value = {
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_AUTHORIZE,
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TENCENT_IOA_AUTHORIZE
|
||||
},
|
||||
method = RequestMethod.GET)
|
||||
public ModelAndView authorize(
|
||||
Map<String, Object> model,
|
||||
@RequestParam Map<String, String> parameters,
|
||||
@@ -225,7 +229,9 @@ public class AuthorizationEndpoint extends AbstractEndpoint {
|
||||
}
|
||||
|
||||
//approval must post
|
||||
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_AUTHORIZE, method = RequestMethod.POST, params = OAuth2Constants.PARAMETER.USER_OAUTH_APPROVAL)
|
||||
@RequestMapping(value = {OAuth2Constants.ENDPOINT.ENDPOINT_AUTHORIZE},
|
||||
params = OAuth2Constants.PARAMETER.USER_OAUTH_APPROVAL,
|
||||
method = RequestMethod.POST)
|
||||
public View approveOrDeny(
|
||||
@RequestParam Map<String, String> approvalParameters,
|
||||
Map<String, ?> model,
|
||||
@@ -334,8 +340,12 @@ public class AuthorizationEndpoint extends AbstractEndpoint {
|
||||
// Authorization Code Response
|
||||
private View getAuthorizationCodeResponse(AuthorizationRequest authorizationRequest, Authentication authUser) {
|
||||
try {
|
||||
return new RedirectView(getSuccessfulRedirect(authorizationRequest,
|
||||
generateCode(authorizationRequest, authUser)), false, true, false);
|
||||
String successfulRedirect = getSuccessfulRedirect(
|
||||
authorizationRequest,
|
||||
generateCode(authorizationRequest, authUser)
|
||||
);
|
||||
_logger.debug("successfulRedirect " + successfulRedirect);
|
||||
return new RedirectView(successfulRedirect, false, true, false);
|
||||
}
|
||||
catch (OAuth2Exception e) {
|
||||
return new RedirectView(getUnsuccessfulRedirect(authorizationRequest, e, false), false, true, false);
|
||||
|
||||
@@ -90,7 +90,11 @@ public class TokenEndpoint extends AbstractEndpoint {
|
||||
* @throws HttpRequestMethodNotSupportedException
|
||||
*/
|
||||
@ApiOperation(value = "OAuth 2.0 获取AccessToken接口", notes = "传递参数token等",httpMethod="GET")
|
||||
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN, method=RequestMethod.GET)
|
||||
@RequestMapping(value = {
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN,
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TENCENT_IOA_TOKEN
|
||||
},
|
||||
method=RequestMethod.GET)
|
||||
public ResponseEntity<OAuth2AccessToken> getAccessToken(@RequestParam
|
||||
Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
|
||||
if (!allowedRequestMethods.contains(HttpMethod.GET)) {
|
||||
@@ -100,7 +104,11 @@ public class TokenEndpoint extends AbstractEndpoint {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "OAuth 2.0 获取AccessToken接口", notes = "传递参数token等",httpMethod="POST")
|
||||
@RequestMapping(value = OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN, method=RequestMethod.POST)
|
||||
@RequestMapping(value = {
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN,
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TENCENT_IOA_TOKEN
|
||||
},
|
||||
method=RequestMethod.POST)
|
||||
public ResponseEntity<OAuth2AccessToken> postAccessToken(@RequestParam
|
||||
Map<String, String> parameters) throws HttpRequestMethodNotSupportedException {
|
||||
// TokenEndpointAuthenticationFilter
|
||||
|
||||
@@ -78,7 +78,10 @@ import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@WebFilter(filterName = "TokenEndpointAuthenticationFilter", urlPatterns = OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN+"/*")
|
||||
@WebFilter( filterName = "TokenEndpointAuthenticationFilter",
|
||||
urlPatterns = {
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN+"/*",
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TENCENT_IOA_TOKEN+"/*"})
|
||||
public class TokenEndpointAuthenticationFilter implements Filter {
|
||||
|
||||
private static final Log logger = LogFactory.getLog(TokenEndpointAuthenticationFilter.class);
|
||||
|
||||
@@ -76,7 +76,9 @@ public class Oauth20AutoConfiguration implements InitializingBean {
|
||||
_logger.debug("TokenEndpointAuthenticationFilter init ");
|
||||
FilterRegistrationBean<Filter> registration = new FilterRegistrationBean<Filter>();
|
||||
registration.setFilter(new TokenEndpointAuthenticationFilter());
|
||||
registration.addUrlPatterns(OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN + "/*");
|
||||
registration.addUrlPatterns(
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TOKEN + "/*",
|
||||
OAuth2Constants.ENDPOINT.ENDPOINT_TENCENT_IOA_TOKEN + "/*");
|
||||
registration.setName("TokenEndpointAuthenticationFilter");
|
||||
registration.setOrder(1);
|
||||
return registration;
|
||||
|
||||
Reference in New Issue
Block a user