Fixing merge
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/776a01d3 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/776a01d3 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/776a01d3 Branch: refs/heads/3.0.x-fixes Commit: 776a01d3f538dabbac6043b01ad8b475a802ef33 Parents: 4549fe2 Author: Colm O hEigeartaigh <cohei...@apache.org> Authored: Wed Jan 27 11:28:54 2016 +0000 Committer: Colm O hEigeartaigh <cohei...@apache.org> Committed: Wed Jan 27 11:28:54 2016 +0000 ---------------------------------------------------------------------- .../cxf/sts/operation/AbstractOperation.java | 24 ------------------- .../cxf/sts/operation/TokenIssueOperation.java | 15 ------------ .../sts/operation/TokenValidateOperation.java | 5 ---- .../cxf/sts/common/CustomAttributeProvider.java | 25 ++++++++++++++++++-- 4 files changed, 23 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/776a01d3/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java index e73e327..1e71e72 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/AbstractOperation.java @@ -669,30 +669,6 @@ public abstract class AbstractOperation { } } -<<<<<<< HEAD - protected void checkClaimsSupport(ClaimCollection requestedClaims) { - if (requestedClaims != null) { - List<URI> unhandledClaimTypes = new ArrayList<URI>(); - for (Claim requestedClaim : requestedClaims) { - if (!claimsManager.getSupportedClaimTypes().contains(requestedClaim.getClaimType()) - && !requestedClaim.isOptional()) { - unhandledClaimTypes.add(requestedClaim.getClaimType()); - } - } - - if (unhandledClaimTypes.size() > 0) { - LOG.log(Level.WARNING, "The requested claim " + unhandledClaimTypes.toString() - + " cannot be fulfilled by the STS."); - throw new STSException( - "The requested claim " + unhandledClaimTypes.toString() - + " cannot be fulfilled by the STS." - ); - } - } - } - -======= ->>>>>>> 60166cf... [CXF-6763] - STS requires ClaimHandler even in ClaimMapping only scenarios protected void processValidToken(TokenProviderParameters providerParameters, ReceivedToken validatedToken, TokenValidatorResponse tokenResponse) { // Map the principal (if it exists) http://git-wip-us.apache.org/repos/asf/cxf/blob/776a01d3/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java index a768171..d15c9fd 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenIssueOperation.java @@ -33,11 +33,6 @@ import javax.xml.ws.handler.MessageContext; import org.apache.cxf.common.logging.LogUtils; import org.apache.cxf.helpers.CastUtils; -<<<<<<< HEAD -import org.apache.cxf.rt.security.claims.ClaimCollection; -======= -import org.apache.cxf.helpers.DOMUtils; ->>>>>>> 60166cf... [CXF-6763] - STS requires ClaimHandler even in ClaimMapping only scenarios import org.apache.cxf.sts.QNameConstants; import org.apache.cxf.sts.event.STSIssueFailureEvent; import org.apache.cxf.sts.event.STSIssueSuccessEvent; @@ -117,17 +112,7 @@ public class TokenIssueOperation extends AbstractOperation implements IssueOpera try { RequestParser requestParser = parseRequest(request, context); -<<<<<<< HEAD providerParameters = createTokenProviderParameters(requestParser, context); - - // Check if the requested claims can be handled by the configured claim handlers - ClaimCollection requestedClaims = providerParameters.getRequestedPrimaryClaims(); - checkClaimsSupport(requestedClaims); - requestedClaims = providerParameters.getRequestedSecondaryClaims(); - checkClaimsSupport(requestedClaims); -======= - providerParameters = createTokenProviderParameters(requestRequirements, context); ->>>>>>> 60166cf... [CXF-6763] - STS requires ClaimHandler even in ClaimMapping only scenarios providerParameters.setClaimsManager(claimsManager); String realm = providerParameters.getRealm(); http://git-wip-us.apache.org/repos/asf/cxf/blob/776a01d3/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java index 0306ad3..9289bfc 100644 --- a/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java +++ b/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenValidateOperation.java @@ -27,11 +27,6 @@ import javax.xml.bind.JAXBElement; import javax.xml.ws.WebServiceContext; import org.apache.cxf.common.logging.LogUtils; -<<<<<<< HEAD -import org.apache.cxf.rt.security.claims.ClaimCollection; -======= -import org.apache.cxf.helpers.DOMUtils; ->>>>>>> 60166cf... [CXF-6763] - STS requires ClaimHandler even in ClaimMapping only scenarios import org.apache.cxf.sts.QNameConstants; import org.apache.cxf.sts.RealmParser; import org.apache.cxf.sts.STSConstants; http://git-wip-us.apache.org/repos/asf/cxf/blob/776a01d3/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java ---------------------------------------------------------------------- diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java index e3deba9..b965b33 100644 --- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java +++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/common/CustomAttributeProvider.java @@ -24,7 +24,8 @@ import java.util.List; import org.w3c.dom.Element; -import org.apache.cxf.sts.claims.ClaimsUtils; +import org.apache.cxf.sts.claims.ClaimsManager; +import org.apache.cxf.sts.claims.ClaimsParameters; import org.apache.cxf.sts.claims.ProcessedClaim; import org.apache.cxf.sts.claims.ProcessedClaimCollection; import org.apache.cxf.sts.request.ReceivedToken; @@ -56,7 +57,27 @@ public class CustomAttributeProvider implements AttributeStatementProvider { String tokenType = tokenRequirements.getTokenType(); // Handle Claims - ProcessedClaimCollection retrievedClaims = ClaimsUtils.processClaims(providerParameters); + ClaimsManager claimsManager = providerParameters.getClaimsManager(); + ProcessedClaimCollection retrievedClaims = new ProcessedClaimCollection(); + if (claimsManager != null) { + ClaimsParameters params = new ClaimsParameters(); + params.setAdditionalProperties(providerParameters.getAdditionalProperties()); + params.setAppliesToAddress(providerParameters.getAppliesToAddress()); + params.setEncryptionProperties(providerParameters.getEncryptionProperties()); + params.setKeyRequirements(providerParameters.getKeyRequirements()); + params.setPrincipal(providerParameters.getPrincipal()); + params.setRealm(providerParameters.getRealm()); + params.setStsProperties(providerParameters.getStsProperties()); + params.setTokenRequirements(providerParameters.getTokenRequirements()); + params.setTokenStore(providerParameters.getTokenStore()); + params.setWebServiceContext(providerParameters.getWebServiceContext()); + retrievedClaims = + claimsManager.retrieveClaimValues( + providerParameters.getRequestedPrimaryClaims(), + providerParameters.getRequestedSecondaryClaims(), + params + ); + } AttributeStatementBean attrBean = new AttributeStatementBean(); Iterator<ProcessedClaim> claimIterator = retrievedClaims.iterator();