You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by az...@apache.org on 2006/09/14 16:52:57 UTC
svn commit: r443374 - in /webservices/axis2/trunk/java/modules:
integration/test/org/apache/rahas/ rahas/src/org/apache/rahas/
rahas/src/org/apache/rahas/client/
security/src/org/apache/rampart/conversation/
Author: azeez
Date: Thu Sep 14 07:52:56 2006
New Revision: 443374
URL: http://svn.apache.org/viewvc?view=rev&rev=443374
Log:
Updates to Cancel binding functionality
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasData.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java
webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKTest.java Thu Sep 14 07:52:56 2006
@@ -76,7 +76,7 @@
Axis2Util.useDOOM(false);
StAXOMBuilder builder = new StAXOMBuilder(new StreamWrapper(rst
.getPullParser(new QName(RahasConstants.WST_NS_05_02,
- RahasConstants.IssuanceBindingLocalNames.REQUEST_SECURITY_TOKEN))));
+ RahasConstants.LocalNames.REQUEST_SECURITY_TOKEN))));
OMElement rstElem = builder.getDocumentElement();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java Thu Sep 14 07:52:56 2006
@@ -106,7 +106,7 @@
public void validateRsponse(OMElement resp) {
OMElement rstr =
resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
REQUEST_SECURITY_TOKEN_RESPONSE));
assertNotNull("RequestedSecurityToken missing", rstr);
OMElement rst =
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenTest.java Thu Sep 14 07:52:56 2006
@@ -79,7 +79,7 @@
Axis2Util.useDOOM(false);
StAXOMBuilder builder = new StAXOMBuilder(new StreamWrapper(rst
.getPullParser(new QName(RahasConstants.WST_NS_05_02,
- RahasConstants.IssuanceBindingLocalNames.REQUEST_SECURITY_TOKEN))));
+ RahasConstants.LocalNames.REQUEST_SECURITY_TOKEN))));
OMElement rstElem = builder.getDocumentElement();
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForBearerV1205Test.java Thu Sep 14 07:52:56 2006
@@ -82,7 +82,7 @@
public void validateRsponse(OMElement resp) {
OMElement rstr = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
REQUEST_SECURITY_TOKEN_RESPONSE));
assertNotNull("RequestedSecurityToken missing", rstr);
OMElement rst = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenUTForHoKV1205Test.java Thu Sep 14 07:52:56 2006
@@ -96,7 +96,8 @@
public void validateRsponse(OMElement resp) {
OMElement rstr = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
- RahasConstants.IssuanceBindingLocalNames.REQUEST_SECURITY_TOKEN_RESPONSE));
+ RahasConstants.LocalNames.
+ REQUEST_SECURITY_TOKEN_RESPONSE));
assertNotNull("RequestedSecurityTokenResponse missing", rstr);
OMElement rst = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
RahasConstants.IssuanceBindingLocalNames.
Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenV1205Test.java Thu Sep 14 07:52:56 2006
@@ -84,7 +84,7 @@
public void validateRsponse(OMElement resp) {
OMElement rstr = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
REQUEST_SECURITY_TOKEN_RESPONSE));
assertNotNull("RequestedSecurityToken missing", rstr);
OMElement rst = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasConstants.java Thu Sep 14 07:52:56 2006
@@ -37,73 +37,74 @@
public final static String WSP_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
public final static String WSP_PREFIX = "wsp";
- public static class IssuanceBindingLocalNames {
- public final static String REQUEST_TYPE = "RequestType";
- public final static String TOKEN_TYPE = "TokenType";
- public final static String REQUEST_SECURITY_TOKEN = "RequestSecurityToken";
- public static final String REQUESTED_PROOF_TOKEN = "RequestedProofToken";
+ public static class LocalNames {
+ public static final String REQUEST_SECURITY_TOKEN = "RequestSecurityToken";
public static final String REQUEST_SECURITY_TOKEN_RESPONSE = "RequestSecurityTokenResponse";
+ public static final String REQUEST_TYPE = "RequestType";
+ public static final String TOKEN_TYPE = "TokenType";
+ public static final String REQUESTED_PROOF_TOKEN = "RequestedProofToken";
public static final String
REQUEST_SECURITY_TOKEN_RESPONSE_COLLECTION = "RequestSecurityTokenResponseCollection";
- public static final String REQUESTED_SECURITY_TOKEN = "RequestedSecurityToken";
public final static String BINARY_SECRET = "BinarySecret";
- public final static String COMPUTED_KEY_ALGO = "ComputedKeyAlgorithm";
- public final static String COMPUTED_KEY = "ComputedKey";
- public final static String REQUESTED_ATTACHED_REFERENCE = "RequestedAttachedReference";
- public final static String REQUESTED_UNATTACHED_REFERENCE = "RequestedUnattachedReference";
- public final static String KEY_SIZE = "KeySize";
- public final static String KEY_TYPE = "KeyType";
- public final static String ENTROPY = "Entropy";
- public final static String APPLIES_TO = "AppliesTo";
- public final static String LIFETIME = "Lifetime";
+ }
+
+ public static class IssuanceBindingLocalNames {
+ public static final String REQUESTED_SECURITY_TOKEN = "RequestedSecurityToken";
+ public static final String COMPUTED_KEY_ALGO = "ComputedKeyAlgorithm";
+ public static final String COMPUTED_KEY = "ComputedKey";
+ public static final String REQUESTED_ATTACHED_REFERENCE = "RequestedAttachedReference";
+ public static final String REQUESTED_UNATTACHED_REFERENCE = "RequestedUnattachedReference";
+ public static final String KEY_SIZE = "KeySize";
+ public static final String KEY_TYPE = "KeyType";
+ public static final String ENTROPY = "Entropy";
+ public static final String APPLIES_TO = "AppliesTo";
+ public static final String LIFETIME = "Lifetime";
}
public static class CancelBindingLocalNames {
- public final static String REQUESTED_TOKEN_CANCELED = "RequestedTokenCancelled";
- public final static String CANCEL_TARGET = "CancelTarget";
- public final static String SECURITY_TOKEN_REF = "SecurityTokenReference";
- public final static String REFERENCE = "Reference";
- public final static String URI = "URI";
+ public static final String REQUESTED_TOKEN_CANCELED = "RequestedTokenCancelled";
+ public static final String CANCEL_TARGET = "CancelTarget";
+ public static final String SECURITY_TOKEN_REF = "SecurityTokenReference";
+ public static final String REFERENCE = "Reference";
+ public static final String URI = "URI";
}
//Key types
- public final static String KEY_TYPE_SYMM_KEY = "/SymmetricKey";
- public final static String KEY_TYPE_PUBLIC_KEY = "/PublicKey";
- public final static String KEY_TYPE_BEARER = "/Bearer";
+ public static final String KEY_TYPE_SYMM_KEY = "/SymmetricKey";
+ public static final String KEY_TYPE_PUBLIC_KEY = "/PublicKey";
+ public static final String KEY_TYPE_BEARER = "/Bearer";
//Attr values
- public final static String BIN_SEC_TYPE_NONCE = "/Nonce";
+ public static final String BIN_SEC_TYPE_NONCE = "/Nonce";
//ComputedKey algos
- public final static String COMPUTED_KEY_PSHA1 = "/CK/PSHA1";
+ public static final String COMPUTED_KEY_PSHA1 = "/CK/PSHA1";
// RequestTypes
- public final static String REQ_TYPE_ISSUE = "/Issue";
- public final static String REQ_TYPE_VALIDATE = "/Validate";
- public final static String REQ_TYPE_RENEW = "/Renew";
- public final static String REQ_TYPE_CANCEL = "/Cancel";
+ public static final String REQ_TYPE_ISSUE = "/Issue";
+ public static final String REQ_TYPE_VALIDATE = "/Validate";
+ public static final String REQ_TYPE_RENEW = "/Renew";
+ public static final String REQ_TYPE_CANCEL = "/Cancel";
//RST actions
- public final static String RST_ACTION_ISSUE = "/RST" + REQ_TYPE_ISSUE;
- public final static String RST_ACTOIN_VALIDATE = "/RST" + REQ_TYPE_VALIDATE;
- public final static String RST_ACTOIN_RENEW = "/RST" + REQ_TYPE_RENEW;
- public final static String RST_ACTION_CANCEL = "/RST" + REQ_TYPE_CANCEL;
- public final static String RST_ACTION_SCT = "/RST/SCT";
+ public static final String RST_ACTION_ISSUE = "/RST" + REQ_TYPE_ISSUE;
+ public static final String RST_ACTOIN_VALIDATE = "/RST" + REQ_TYPE_VALIDATE;
+ public static final String RST_ACTOIN_RENEW = "/RST" + REQ_TYPE_RENEW;
+ public static final String RST_ACTION_CANCEL = "/RST" + REQ_TYPE_CANCEL;
+ public static final String RST_ACTION_SCT = "/RST/SCT";
//RSTR actions
- public final static String RSTR_ACTON_ISSUE = "/RSTR" + REQ_TYPE_ISSUE;
- public final static String RSTR_ACTON_VALIDATE = "/RSTR" + REQ_TYPE_VALIDATE;
- public final static String RSTR_ACTON_RENEW = "/RSTR" + REQ_TYPE_RENEW;
- public final static String RSTR_ACTION_CANCEL = "/RSTR" + REQ_TYPE_CANCEL;
- public final static String RSTR_ACTON_SCT = "/RSTR/SCT";
+ public static final String RSTR_ACTON_ISSUE = "/RSTR" + REQ_TYPE_ISSUE;
+ public static final String RSTR_ACTON_VALIDATE = "/RSTR" + REQ_TYPE_VALIDATE;
+ public static final String RSTR_ACTON_RENEW = "/RSTR" + REQ_TYPE_RENEW;
+ public static final String RSTR_ACTION_CANCEL = "/RSTR" + REQ_TYPE_CANCEL;
+ public static final String RSTR_ACTON_SCT = "/RSTR/SCT";
//Token types
- public final static String TOK_TYPE_SAML_10 = "http://docs.oasis-open.org/wss/" +
+ public static final String TOK_TYPE_SAML_10 = "http://docs.oasis-open.org/wss/" +
"oasis-wss-saml-token-profile-1.1#SAMLV1.1";
//Attrs
- public final static String ATTR_TYPE = "Type";
-
-
+ public static final String ATTR_TYPE = "Type";
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasData.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasData.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasData.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/RahasData.java Thu Sep 14 07:52:56 2006
@@ -132,7 +132,7 @@
* we will not be encrypting the response
*/
- Vector results = null;
+ Vector results;
if ((results = (Vector) this.inMessageContext
.getProperty(WSHandlerConstants.RECV_RESULTS)) == null) {
throw new TrustException(TrustException.REQUEST_FAILED);
@@ -198,22 +198,21 @@
private void processRequestType() throws TrustException {
OMElement reqTypeElem = this.rstElement
.getFirstChildWithName(new QName(this.wstNs,
- RahasConstants.IssuanceBindingLocalNames.REQUEST_TYPE));
+ RahasConstants.LocalNames.REQUEST_TYPE));
- if (reqTypeElem == null
- || (reqTypeElem != null && reqTypeElem.getText() != null && ""
- .equals(reqTypeElem.getText().trim()))) {
+ if (reqTypeElem == null ||
+ reqTypeElem.getText() == null ||
+ reqTypeElem.getText().trim().length() == 0) {
throw new TrustException(TrustException.INVALID_REQUEST);
} else {
this.requestType = reqTypeElem.getText().trim();
}
-
}
private void processTokenType() {
OMElement tokTypeElem = this.rstElement
.getFirstChildWithName(new QName(this.wstNs,
- RahasConstants.IssuanceBindingLocalNames.TOKEN_TYPE));
+ RahasConstants.LocalNames.TOKEN_TYPE));
if (tokTypeElem != null && tokTypeElem.getText() != null
&& !"".equals(tokTypeElem.getText().trim())) {
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TrustUtil.java Thu Sep 14 07:52:56 2006
@@ -39,6 +39,9 @@
import java.util.Date;
public class TrustUtil {
+ private static final String WSSE_NAMESPACE_URI =
+ "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
+ private static final String WSSE_PREFIX = "wsse";
/**
* Create a wsse:Reference element with the given uri and the value type
@@ -67,7 +70,7 @@
OMElement parent) throws TrustException {
return createOMElement(parent,
getWSTNamespace(version),
- RahasConstants.IssuanceBindingLocalNames.REQUEST_SECURITY_TOKEN_RESPONSE,
+ RahasConstants.LocalNames.REQUEST_SECURITY_TOKEN_RESPONSE,
RahasConstants.WST_PREFIX);
}
@@ -76,7 +79,7 @@
OMElement parent) throws TrustException {
String ns = getWSTNamespace(version);
return createOMElement(parent, ns,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
REQUEST_SECURITY_TOKEN_RESPONSE_COLLECTION,
RahasConstants.WST_PREFIX);
}
@@ -93,7 +96,7 @@
String ns = getWSTNamespace(version);
OMFactory fac = OMAbstractFactory.getOMFactory();
return fac.
- createOMElement(RahasConstants.IssuanceBindingLocalNames.REQUEST_SECURITY_TOKEN,
+ createOMElement(RahasConstants.LocalNames.REQUEST_SECURITY_TOKEN,
ns,
RahasConstants.WST_PREFIX);
}
@@ -102,7 +105,7 @@
int version, OMElement parent) throws TrustException {
String ns = getWSTNamespace(version);
return createOMElement(parent, ns,
- RahasConstants.IssuanceBindingLocalNames.REQUESTED_PROOF_TOKEN,
+ RahasConstants.LocalNames.REQUESTED_PROOF_TOKEN,
RahasConstants.WST_PREFIX);
}
@@ -129,7 +132,7 @@
OMElement elem = createOMElement(parent,
ns,
- RahasConstants.IssuanceBindingLocalNames.REQUEST_TYPE,
+ RahasConstants.LocalNames.REQUEST_TYPE,
RahasConstants.WST_PREFIX);
if (RahasConstants.REQ_TYPE_ISSUE.equals(value)
@@ -148,7 +151,7 @@
OMElement parent) throws TrustException {
return createOMElement(parent,
getWSTNamespace(version),
- RahasConstants.IssuanceBindingLocalNames.TOKEN_TYPE,
+ RahasConstants.LocalNames.TOKEN_TYPE,
RahasConstants.WST_PREFIX);
}
@@ -156,7 +159,7 @@
OMElement parent) throws TrustException {
return createOMElement(parent,
getWSTNamespace(version),
- RahasConstants.IssuanceBindingLocalNames.TOKEN_TYPE,
+ RahasConstants.LocalNames.TOKEN_TYPE,
RahasConstants.WST_PREFIX);
}
@@ -166,7 +169,7 @@
String type) throws TrustException {
String ns = getWSTNamespace(version);
OMElement elem = createOMElement(parent, ns,
- RahasConstants.IssuanceBindingLocalNames.BINARY_SECRET,
+ RahasConstants.LocalNames.BINARY_SECRET,
RahasConstants.WST_PREFIX);
if (type != null) {
elem.addAttribute(elem.getOMFactory().createOMAttribute(
@@ -441,5 +444,42 @@
RahasConstants.CancelBindingLocalNames.CANCEL_TARGET,
RahasConstants.WST_PREFIX);
+ }
+
+ public static OMElement createCancelRequest(String requestType,
+ String tokenId,
+ int version) throws TrustException {
+ /*
+ <wst:RequestSecurityToken>
+ <wst:RequestType>
+ http://schemas.xmlsoap.org/ws/2005/02/trust/Cancel
+ </wst:RequestType>
+ <wst:CancelTarget>
+ <o:SecurityTokenReference
+ xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
+ <o:Reference URI="urn:uuid:8e6a3a95-fd1b-4c24-96d4-28e875025ff7"
+ ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" />
+ </o:SecurityTokenReference>
+ </wst:CancelTarget>
+ </wst:RequestSecurityToken>
+ */
+ OMElement rst = TrustUtil.createRequestSecurityTokenElement(version);
+ TrustUtil.createRequestTypeElement(version, rst, requestType);
+ OMElement cancelTargetEle = TrustUtil.createCancelTargetElement(version, rst);
+ OMFactory factory = DOOMAbstractFactory.getOMFactory();
+ OMElement secTokenRefEle =
+ factory.createOMElement(RahasConstants.CancelBindingLocalNames.SECURITY_TOKEN_REF,
+ WSSE_NAMESPACE_URI,
+ WSSE_PREFIX);
+ OMElement refEle =
+ factory.createOMElement(RahasConstants.CancelBindingLocalNames.REFERENCE,
+ WSSE_NAMESPACE_URI,
+ WSSE_PREFIX);
+ refEle.addAttribute(factory.createOMAttribute(RahasConstants.CancelBindingLocalNames.URI,
+ null, tokenId));
+ secTokenRefEle.addChild(refEle);
+ cancelTargetEle.addChild(secTokenRefEle);
+
+ return rst;
}
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/client/STSClient.java Thu Sep 14 07:52:56 2006
@@ -18,6 +18,7 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
import org.apache.axiom.om.util.Base64;
@@ -89,11 +90,8 @@
* Default is 300 seconds (5 mins)
*/
private int ttl = 300;
-
private Crypto crypto;
-
private CallbackHandler cbHandler;
-
private ConfigurationContext configCtx;
public STSClient(ConfigurationContext configCtx) throws TrustException {
@@ -122,7 +120,7 @@
OMElement response = client.sendReceive(rstQn,
createIssueRequest(requestType, appliesTo));
- return this.processIssueResponse(version, response);
+ return processIssueResponse(version, response);
} catch (AxisFault e) {
log.error("errorInObtainingToken", e);
throw new TrustException("errorInObtainingToken", new String[]{issuerAddress});
@@ -144,9 +142,7 @@
String requestType =
TrustUtil.getWSTNamespace(version) + RahasConstants.REQ_TYPE_CANCEL;
ServiceClient client = getServiceClient(rstQn, issuerAddress);
-
- return processCancelResponse(version,
- client.sendReceive(rstQn,
+ return processCancelResponse(client.sendReceive(rstQn,
createCancelRequest(requestType,
tokenId)));
} catch (AxisFault e) {
@@ -191,8 +187,7 @@
//Get the RequestedAttachedReference
OMElement reqAttElem = rstr.getFirstChildWithName(new QName(
ns, RahasConstants.IssuanceBindingLocalNames.REQUESTED_ATTACHED_REFERENCE));
- OMElement reqAttRef = reqAttElem == null ? null : reqAttElem
- .getFirstElement();
+ OMElement reqAttRef = reqAttElem == null ? null : reqAttElem.getFirstElement();
//Get the RequestedUnattachedReference
OMElement reqUnattElem =
@@ -230,7 +225,7 @@
//Handle proof token
OMElement rpt =
rstr.getFirstChildWithName(new QName(ns,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
REQUESTED_PROOF_TOKEN));
byte[] secret = null;
@@ -241,7 +236,7 @@
throw new TrustException("invalidRPT");
}
if (child.getQName().equals(new QName(ns,
- RahasConstants.IssuanceBindingLocalNames.
+ RahasConstants.LocalNames.
BINARY_SECRET))) {
//First check for the binary secret
String b64Secret = child.getText();
@@ -307,9 +302,15 @@
return token;
}
- private boolean processCancelResponse(int version, OMElement response) throws TrustException {
- //TODO: impl
- return false;
+ private boolean processCancelResponse(OMElement response) {
+ /*
+ <wst:RequestSecurityTokenResponse>
+ <wst:RequestedTokenCancelled/>
+ </wst:RequestSecurityTokenResponse>
+ */
+ return response.
+ getFirstChildWithName(new QName(RahasConstants.
+ CancelBindingLocalNames.REQUESTED_TOKEN_CANCELED)) != null;
}
/**
@@ -489,26 +490,8 @@
private OMElement createCancelRequest(String requestType,
String tokenId) throws TrustException {
- /*
- <wst:RequestSecurityToken>
- <wst:RequestType>
- http://schemas.xmlsoap.org/ws/2005/02/trust/Cancel
- </wst:RequestType>
- <wst:CancelTarget>
- <o:SecurityTokenReference
- xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
- <o:Reference URI="urn:uuid:8e6a3a95-fd1b-4c24-96d4-28e875025ff7"
- ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" />
- </o:SecurityTokenReference>
- </wst:CancelTarget>
- </wst:RequestSecurityToken>
- */
- OMElement rst = TrustUtil.createRequestSecurityTokenElement(version);
- TrustUtil.createRequestTypeElement(this.version, rst, requestType);
- OMElement cancelTargetEle = TrustUtil.createCancelTargetElement(this.version, rst);
- // TODO: add SecurityTokenReference to cancelTargetEle
- return rst;
+ return TrustUtil.createCancelRequest(requestType, tokenId, version);
}
/**
Modified: webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java?view=diff&rev=443374&r1=443373&r2=443374
==============================================================================
--- webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java (original)
+++ webservices/axis2/trunk/java/modules/security/src/org/apache/rampart/conversation/Util.java Thu Sep 14 07:52:56 2006
@@ -114,7 +114,8 @@
// Process RequestedProofToken and extract the secret
byte[] secret = null;
OMElement rpt = rstr.getFirstChildWithName(new QName(ns,
- RahasConstants.IssuanceBindingLocalNames.REQUESTED_PROOF_TOKEN));
+ RahasConstants.LocalNames.
+ REQUESTED_PROOF_TOKEN));
if (rpt != null) {
OMElement elem = rpt.getFirstElement();
@@ -127,9 +128,8 @@
getCallbackHandlerInstance(config), null, new Vector(),
null);
secret = processor.getDecryptedBytes();
- } else if (RahasConstants.IssuanceBindingLocalNames.
- BINARY_SECRET.equals(elem.getLocalName())
- && RahasConstants.WST_NS_05_02.equals(elem.getNamespace().getNamespaceURI()))
+ } else if (RahasConstants.LocalNames.BINARY_SECRET.equals(elem.getLocalName()) &&
+ RahasConstants.WST_NS_05_02.equals(elem.getNamespace().getNamespaceURI()))
{
// Handle the wst:BinarySecret case
secret = Base64.decode(elem.getText());
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org