Author: coheigea
Date: Wed Apr 4 16:03:25 2012
New Revision: 1309473
URL: http://svn.apache.org/viewvc?rev=1309473&view=rev
Log:
[CXF-4158] - Some minor stuff related to token renewing
Removed:
cxf/trunk/services/sts/sts-core/src/test/java/org/apache/cxf/sts/token/renewer/SCTRenewerTest.java
cxf/trunk/services/sts/systests/advanced/src/test/java/org/apache/cxf/systest/sts/secure_conv/SecurityContextTokenRenewTest.java
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java?rev=1309473&r1=1309472&r2=1309473&view=diff
==============================================================================
---
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
(original)
+++
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/operation/TokenRenewOperation.java
Wed Apr 4 16:03:25 2012
@@ -31,7 +31,6 @@ import javax.xml.ws.WebServiceContext;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.sts.QNameConstants;
import org.apache.cxf.sts.RealmParser;
-import org.apache.cxf.sts.claims.RequestClaimCollection;
import org.apache.cxf.sts.request.KeyRequirements;
import org.apache.cxf.sts.request.ReceivedToken;
import org.apache.cxf.sts.request.ReceivedToken.STATE;
@@ -66,7 +65,16 @@ public class TokenRenewOperation extends
private static final Logger LOG =
LogUtils.getL7dLogger(TokenRenewOperation.class);
private List<TokenRenewer> tokenRenewers = new ArrayList<TokenRenewer>();
+ private boolean allowRenewalBeforeExpiry;
+ public boolean isAllowRenewalBeforeExpiry() {
+ return allowRenewalBeforeExpiry;
+ }
+
+ public void setAllowRenewalBeforeExpiry(boolean allowRenewalBeforeExpiry) {
+ this.allowRenewalBeforeExpiry = allowRenewalBeforeExpiry;
+ }
+
public void setTokenRenewers(List<TokenRenewer> tokenRenewerList) {
this.tokenRenewers = tokenRenewerList;
}
@@ -124,8 +132,9 @@ public class TokenRenewOperation extends
);
}
- // Reject an valid token (not expired) by default
- if (tokenResponse.getToken().getState() != STATE.EXPIRED) {
+ // Reject a non-expired token (valid or invalid) by default
+ if (tokenResponse.getToken().getState() != STATE.EXPIRED
+ && !(allowRenewalBeforeExpiry &&
tokenResponse.getToken().getState() == STATE.VALID)) {
LOG.fine("The token is not expired, and so it cannot be renewed");
throw new STSException(
"No Token Validator has been found that can handle this token"
@@ -142,11 +151,6 @@ public class TokenRenewOperation extends
TokenProviderParameters providerParameters =
createTokenProviderParameters(requestParser, context);
- // Check if the requested claims can be handled by the configured
claim handlers
- RequestClaimCollection requestedClaims =
providerParameters.getRequestedClaims();
- checkClaimsSupport(requestedClaims);
- providerParameters.setClaimsManager(claimsManager);
-
Map<String, Object> additionalProperties =
tokenResponse.getAdditionalProperties();
if (additionalProperties != null) {
providerParameters.setAdditionalProperties(additionalProperties);
Modified:
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java?rev=1309473&r1=1309472&r2=1309473&view=diff
==============================================================================
---
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
(original)
+++
cxf/trunk/services/sts/sts-core/src/main/java/org/apache/cxf/sts/token/validator/SAMLTokenValidator.java
Wed Apr 4 16:03:25 2012
@@ -216,6 +216,7 @@ public class SAMLTokenValidator implemen
}
}
}
+ response.setTokenRealm(tokenRealm);
if (!validateConditions(assertion, validateTarget, secToken,
tokenParameters.getTokenStore())) {
return response;
@@ -233,7 +234,6 @@ public class SAMLTokenValidator implemen
addProps.put(AssertionWrapper.class.getName(), assertion);
response.setAdditionalProperties(addProps);
- response.setTokenRealm(tokenRealm);
validateTarget.setState(STATE.VALID);
} catch (WSSecurityException ex) {
LOG.log(Level.WARNING, "", ex);