Skip to content
Permalink
Browse files
[CXF-5561] Introducing constants
git-svn-id: https://svn.apache.org/repos/asf/cxf/trunk@1567911 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Sergey Beryozkin committed Feb 13, 2014
1 parent 39e35f4 commit 045f6d10f748323d7298491bff368fdf970bcdc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
@@ -43,7 +43,8 @@ public AccessTokenValidation validateAccessToken(MessageContext mc,
String authSchemeData)
throws OAuthServiceException {
WebClient client = WebClient.fromClient(tokenValidatorClient, true);
Form form = new Form().param("authScheme", authScheme).param("authSchemeData", authSchemeData);
Form form = new Form().param(OAuthConstants.AUTHORIZATION_SCHEME_TYPE, authScheme)
.param(OAuthConstants.AUTHORIZATION_SCHEME_DATA, authSchemeData);
return client.post(form, AccessTokenValidation.class);
}

@@ -28,14 +28,16 @@

import org.apache.cxf.rs.security.oauth2.common.AccessTokenValidation;
import org.apache.cxf.rs.security.oauth2.utils.AuthorizationUtils;
import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;

@Path("validate")
public class AccessTokenValidatorService extends AbstractAccessTokenValidator {
@POST
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public AccessTokenValidation getTokenValidationInfo(@FormParam("authScheme") String authScheme,
@Encoded @FormParam("authScheme") String authSchemeData) {
public AccessTokenValidation getTokenValidationInfo(
@FormParam(OAuthConstants.AUTHORIZATION_SCHEME_TYPE) String authScheme,
@Encoded @FormParam(OAuthConstants.AUTHORIZATION_SCHEME_DATA) String authSchemeData) {
if (getMessageContext().getSecurityContext().getUserPrincipal() == null) {
AuthorizationUtils.throwAuthorizationFailure(supportedSchemes, realm);
}
@@ -112,6 +112,9 @@ public final class OAuthConstants {
public static final String REVOKED_TOKEN_TYPE_HINT = "token_type_hint";
public static final String UNSUPPORTED_TOKEN_TYPE = "unsupported_token_type";

// Authorization scheme constants, used internally by AccessTokenValidation client and service
public static final String AUTHORIZATION_SCHEME_TYPE = "authScheme";
public static final String AUTHORIZATION_SCHEME_DATA = "authSchemeData";

private OAuthConstants() {
}

0 comments on commit 045f6d1

Please sign in to comment.