You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by az...@apache.org on 2006/09/12 18:25:09 UTC
svn commit: r442635 - in /webservices/axis2/trunk/java/modules:
integration/test/org/apache/rahas/ rahas/src/META-INF/
rahas/src/org/apache/rahas/ rahas/src/org/apache/rahas/impl/
Author: azeez
Date: Tue Sep 12 09:25:08 2006
New Revision: 442635
URL: http://svn.apache.org/viewvc?view=rev&rev=442635
Log:
1. Started work on Truest Cancel binding
2. Introduced a "type" attribute for Token Request Dispatcher Configuration
Added:
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceler.java
- copied, changed from r442186, webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceller.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerConfig.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerImpl.java
Removed:
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceller.java
Modified:
webservices/axis2/trunk/java/modules/integration/test/org/apache/rahas/RahasSAMLTokenCertForHoKV1205Test.java
webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
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=442635&r1=442634&r2=442635
==============================================================================
--- 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 Tue Sep 12 09:25:08 2006
@@ -35,27 +35,35 @@
public RahasSAMLTokenCertForHoKV1205Test(String name) {
super(name);
}
+
public OMElement getRequest() {
try {
- OMElement rstElem = TrustUtil.createRequestSecurityTokenElement(RahasConstants.VERSION_05_12);
- OMElement reqTypeElem = TrustUtil.createRequestTypeElement(RahasConstants.VERSION_05_12, rstElem, RahasConstants.REQ_TYPE_ISSUE);
- OMElement tokenTypeElem = TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, rstElem);
+ OMElement rstElem =
+ TrustUtil.createRequestSecurityTokenElement(RahasConstants.VERSION_05_12);
+ OMElement reqTypeElem =
+ TrustUtil.createRequestTypeElement(RahasConstants.VERSION_05_12,
+ rstElem,
+ RahasConstants.REQ_TYPE_ISSUE);
+ OMElement tokenTypeElem =
+ TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12,
+ rstElem);
tokenTypeElem.setText(RahasConstants.TOK_TYPE_SAML_10);
-
- TrustUtil.createAppliesToElement(rstElem,
+
+ TrustUtil.createAppliesToElement(rstElem,
// "http://207.200.37.116/Ping/Scenario4", this.getWSANamespace());
- "http://localhost:5555/axis2/services/SecureService", this.getWSANamespace());
+"http://localhost:5555/axis2/services/SecureService", this.getWSANamespace());
TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12,
- rstElem, RahasConstants.KEY_TYPE_PUBLIC_KEY);
+ rstElem, RahasConstants.KEY_TYPE_PUBLIC_KEY);
TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_12, rstElem, 256);
-
-
+
+
return rstElem;
-
+
} catch (Exception e) {
throw new RuntimeException(e);
}
}
+
public OutflowConfiguration getClientOutflowConfiguration() {
OutflowConfiguration ofc = new OutflowConfiguration();
@@ -76,7 +84,7 @@
// "{Element}{" + RahasConstants.WSA_NS + "}MessageID;" +
// "{Element}{" + RahasConstants.WSA_NS + "}Action;" +
// "{Element}{" + WSConstants.WSU_NS + "}Timestamp");
-
+
return ofc;
}
@@ -87,28 +95,32 @@
ifc.setPasswordCallbackClass(PWCallback.class.getName());
ifc.setSignaturePropFile("rahas-sec.properties");
ifc.setEnableSignatureConfirmation(false);
-
+
return ifc;
}
public String getServiceRepo() {
return "rahas_service_repo_1";
}
-
+
public void validateRsponse(OMElement resp) {
- OMElement rstr = resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12, RahasConstants.REQUEST_SECURITY_TOKEN_RESPONSE_LN));
+ OMElement rstr =
+ resp.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
+ RahasConstants.REQUEST_SECURITY_TOKEN_RESPONSE_LN));
assertNotNull("RequestedSecurityToken missing", rstr);
- OMElement rst = rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12, RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
+ OMElement rst =
+ rstr.getFirstChildWithName(new QName(RahasConstants.WST_NS_05_12,
+ RahasConstants.REQUESTED_SECURITY_TOKEN_LN));
assertNotNull("RequestedSecurityToken missing", rst);
OMElement elem = rst.getFirstChildWithName(new QName(XML.SAML_NS, "Assertion"));
assertNotNull("Missing SAML Assertoin", elem);
-
+
}
public String getRequestAction() throws TrustException {
return TrustUtil.getActionValue(RahasConstants.VERSION_05_02, RahasConstants.RST_ACTON_ISSUE);
}
-
+
public Policy getServicePolicy() throws Exception {
return this.getPolicy("test-resources/rahas/policy/service-policy-symm-binding.xml");
}
@@ -116,19 +128,23 @@
public Policy getSTSPolicy() throws Exception {
return this.getPolicy("test-resources/rahas/policy/sts-policy-asymm-binding.xml");
}
-
+
public OMElement getRSTTemplate() throws TrustException {
OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement elem = factory.createOMElement(Constants.RST_TEMPLATE.getLocalPart(), factory.createOMNamespace(Constants.RST_TEMPLATE.getNamespaceURI(),"wsp"));
-
- TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, elem).setText(RahasConstants.TOK_TYPE_SAML_10);
- TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12, elem, RahasConstants.KEY_TYPE_SYMM_KEY);
+ OMElement elem =
+ factory.createOMElement(Constants.RST_TEMPLATE.getLocalPart(),
+ factory.createOMNamespace(Constants.RST_TEMPLATE.getNamespaceURI(), "wsp"));
+
+ TrustUtil.createTokenTypeElement(RahasConstants.VERSION_05_12, elem).
+ setText(RahasConstants.TOK_TYPE_SAML_10);
+ TrustUtil.createKeyTypeElement(RahasConstants.VERSION_05_12, elem,
+ RahasConstants.KEY_TYPE_SYMM_KEY);
TrustUtil.createKeySizeElement(RahasConstants.VERSION_05_12, elem, 256);
-
+
return elem;
}
-
+
public int getTrstVersion() {
return RahasConstants.VERSION_05_12;
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml?view=diff&rev=442635&r1=442634&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/META-INF/module.xml Tue Sep 12 09:25:08 2006
@@ -2,11 +2,11 @@
<Description>This module is used to STS enable a service where it adds the RequestSecurityToken operation to a service that the module is engaged to</Description>
<supported-policy-namespaces namespaces="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"/>
-
+
<operation name="RequestSecurityToken" mep="http://www.w3.org/2004/08/wsdl/in-out">
<messageReceiver class="org.apache.rahas.STSMessageReceiver"/>
- <!-- Action mapping to accept SCT requests -->
+ <!-- Action mapping to accept SCT requests -->
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</actionMapping>
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</actionMapping>
@@ -17,16 +17,18 @@
<parameter name="token-dispatcher-configuration">
<token-dispatcher-configuration>
<issuer class="org.apache.rahas.impl.SCTIssuer" default="true">
- <configuration-param>sct-issuer-config</configuration-param>
+ <configuration type="parameter">sct-issuer-config</configuration>
<tokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</tokenType>
</issuer>
<issuer class="org.apache.rahas.impl.SAMLTokenIssuer">
- <configuration-param>saml-issuer-config</configuration-param>
+ <configuration type="parameter">saml-issuer-config</configuration>
<tokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</tokenType>
</issuer>
- </token-dispatcher-configuration>
+
+ <!-- TODO: -->
+ </token-dispatcher-configuration>
</parameter>
</operation>
-
+
</module>
Copied: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceler.java (from r442186, webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceller.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceler.java?view=diff&rev=442635&p1=webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceller.java&r1=442186&p2=webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceler.java&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceller.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenCanceler.java Tue Sep 12 09:25:08 2006
@@ -17,9 +17,10 @@
package org.apache.rahas;
import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.om.OMElement;
+
+public interface TokenCanceler {
-public interface TokenCanceller {
-
/**
* Cancel the token specified in the request.
* @param data
@@ -28,7 +29,7 @@
* @throws TrustException
*/
public SOAPEnvelope cancel(RahasData data) throws TrustException;
-
+
/**
* Set the configuration file of this TokenCanceller.
*
@@ -37,7 +38,7 @@
* @param configFile
*/
public void setConfigurationFile(String configFile);
-
+
/**
* Set the configuration element of this TokenCanceller.
*
@@ -46,8 +47,8 @@
*
* @param configElement <code>OMElement</code> representing the configuation
*/
- public void setConfigurationElement(String configElement);
-
+ public void setConfigurationElement(OMElement configElement);
+
/**
* Set the name of the configuration parameter.
*
@@ -59,5 +60,5 @@
* @param configParamName
*/
public void setConfigurationParamName(String configParamName);
-
+
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java?view=diff&rev=442635&r1=442634&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcher.java Tue Sep 12 09:25:08 2006
@@ -23,8 +23,7 @@
private TokenRequestDispatcherConfig config;
- public TokenRequestDispatcher(TokenRequestDispatcherConfig config)
- throws TrustException {
+ public TokenRequestDispatcher(TokenRequestDispatcherConfig config) throws TrustException {
this.config = config;
}
@@ -38,13 +37,12 @@
/**
* Processes the incoming request and returns a SOAPEnvelope
- * @param request
* @param inMsgCtx
* @return
* @throws TrustException
*/
- public SOAPEnvelope handle(MessageContext inMsgCtx, MessageContext outMsgCtx)
- throws TrustException {
+ public SOAPEnvelope handle(MessageContext inMsgCtx,
+ MessageContext outMsgCtx) throws TrustException {
RahasData data = new RahasData(inMsgCtx);
@@ -52,19 +50,17 @@
String tokenType = data.getTokenType();
if ((RahasConstants.WST_NS_05_02 + RahasConstants.REQ_TYPE_ISSUE).equals(reqType) ||
(RahasConstants.WST_NS_05_12 + RahasConstants.REQ_TYPE_ISSUE).equals(reqType)) {
- TokenIssuer issuer = null;
- if (tokenType == null
- || (tokenType != null && "".equals(tokenType.toString()))) {
+ TokenIssuer issuer;
+ if (tokenType == null || tokenType.trim().length() == 0) {
issuer = config.getDefaultIssuerInstace();
} else {
- issuer = config.getIssuer(tokenType.toString());
+ issuer = config.getIssuer(tokenType);
}
SOAPEnvelope response = issuer.issue(data);
//set the response wsa/soap action in teh out message context
- outMsgCtx.getOptions().setAction(
- issuer.getResponseAction(data));
+ outMsgCtx.getOptions().setAction(issuer.getResponseAction(data));
return response;
} else if((RahasConstants.WST_NS_05_02 + RahasConstants.REQ_TYPE_VALIDATE).equals(reqType) ||
@@ -77,6 +73,14 @@
"renew requests");
} else if((RahasConstants.WST_NS_05_02 + RahasConstants.REQ_TYPE_CANCEL).equals(reqType) ||
(RahasConstants.WST_NS_05_12 + RahasConstants.REQ_TYPE_CANCEL).equals(reqType)) {
+
+ TokenCanceler canceler;
+
+ //TODO : Work-in-progress
+
+// http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Cancel
+//http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Cancel
+
throw new UnsupportedOperationException("TODO: handle " +
"cancel requests");
} else {
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java?view=diff&rev=442635&r1=442634&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/TokenRequestDispatcherConfig.java Tue Sep 12 09:25:08 2006
@@ -29,159 +29,153 @@
public final static String CONFIG_PARAM_KEY = "token-dispatcher-configuration";
public final static String CONFIG_FILE_KEY = "token-dispatcher-configuration-file";
-
+
private final static QName DISPATCHER_CONFIG = new QName("token-dispatcher-configuration");
public final static QName ISSUER = new QName("issuer");
public final static QName TOKEN_TYPE = new QName("tokenType");
public final static QName CLASS_ATTR = new QName("class");
public final static QName DEFAULT_ATTR = new QName("default");
-
- public final static QName CONFIGURATION_FILE = new QName("configuration-file");
- public final static QName CONFIGURATION_PARAM = new QName("configuration-param");
- public final static QName CONFIGURATION_ELEMENT = new QName("configuration");
-
+
+ private final static QName CONFIGURATION_ELEMENT = new QName("configuration");
+
private Hashtable issuers;
-
+
private Hashtable configFiles = new Hashtable();
-
+
private Hashtable configElements = new Hashtable();
private Hashtable configParamNames = new Hashtable();
-
+
private String defaultIssuerClassName;
-
-
+
+
public static TokenRequestDispatcherConfig load(OMElement configElem)
throws TrustException {
-
- if(!DISPATCHER_CONFIG.equals(configElem.getQName())) {
+
+ if (!DISPATCHER_CONFIG.equals(configElem.getQName())) {
throw new TrustException("incorrectConfiguration");
}
-
TokenRequestDispatcherConfig conf = new TokenRequestDispatcherConfig();
-
- Iterator issuerElems = configElem.getChildrenWithName(ISSUER);
- while (issuerElems.hasNext()) {
+ for (Iterator issuerElems = configElem.getChildrenWithName(ISSUER);
+ issuerElems.hasNext();) {
+
OMElement element = (OMElement) issuerElems.next();
//get the class attr
String issuerClass = element.getAttributeValue(CLASS_ATTR);
- if(issuerClass == null) {
+ if (issuerClass == null) {
throw new TrustException("missingClassName");
}
String isDefault = element.getAttributeValue(DEFAULT_ATTR);
- if(isDefault != null && "true".equalsIgnoreCase(isDefault)) {
+ if (isDefault != null && "true".equalsIgnoreCase(isDefault)) {
//Use the first default issuer as the default isser
- if(conf.defaultIssuerClassName == null) {
+ if (conf.defaultIssuerClassName == null) {
conf.defaultIssuerClassName = issuerClass;
} else {
throw new TrustException("badDispatcherConfigMultipleDefaultIssuers");
}
- }
-
- //Process configuration file information
- OMElement issuerConfigFileElement = element.getFirstChildWithName(CONFIGURATION_FILE);
- String issuerConfigFile = (issuerConfigFileElement != null) ? issuerConfigFileElement.getText() : null;
- if(issuerConfigFile != null) {
- conf.configFiles.put(issuerClass, issuerConfigFile);
- }
-
- //Process configuration element information
- OMElement issuerConfigElement = element.getFirstChildWithName(CONFIGURATION_ELEMENT);
- if(issuerConfigElement != null) {
- conf.configElements.put(issuerClass, issuerConfigElement);
}
- //Process configuration parameter name information
- OMElement issuerParamNameElem = element.getFirstChildWithName(CONFIGURATION_PARAM);
- String issuerParamName = (issuerParamNameElem != null) ? issuerParamNameElem.getText() : null;
- if(issuerParamName != null) {
- conf.configParamNames.put(issuerClass, issuerParamName);
+ for (Iterator configs = element.getChildrenWithName(CONFIGURATION_ELEMENT);
+ configs.hasNext();) {
+ OMElement configEle = (OMElement) configs.next();
+ String configType =
+ configEle.getAttribute(new QName("type")).getAttributeValue().trim();
+ if (configType.equalsIgnoreCase("file")) { //Process configuration file information
+ String issuerConfigFile = configEle.getText();
+ if (issuerConfigFile != null) {
+ conf.configFiles.put(issuerClass, issuerConfigFile);
+ }
+ } else if(configType.equalsIgnoreCase("element")){ //Process configuration element information
+ conf.configElements.put(issuerClass, configEle);
+ } else if(configType.equalsIgnoreCase("parameter")){ //Process configuration parameter name information
+ conf.configParamNames.put(issuerClass, configEle.getText());
+ }
}
-
+
//Process token types
Iterator tokenTypes = element.getChildrenWithName(TOKEN_TYPE);
while (tokenTypes.hasNext()) {
OMElement type = (OMElement) tokenTypes.next();
String value = type.getText();
- if(value == null || "".equals(value)) {
+ if (value == null || "".equals(value)) {
throw new TrustException("invalidTokenTypeDefinition",
- new String[] { "Issuer", issuerClass });
+ new String[]{"Issuer", issuerClass});
}
- if(conf.issuers == null) {
+ if (conf.issuers == null) {
conf.issuers = new Hashtable();
}
//If the token type is not aleady declared then add it to the
//table with the issuer classname
- if(!conf.issuers.keySet().contains(value)) {
+ if (!conf.issuers.keySet().contains(value)) {
conf.issuers.put(value, issuerClass);
}
}
}
-
+
//There must be a defulat issuer
- if(conf.defaultIssuerClassName == null) {
+ if (conf.defaultIssuerClassName == null) {
throw new TrustException("defaultIssuerMissing");
}
-
+
return conf;
}
public static TokenRequestDispatcherConfig load(String configFilePath)
throws TrustException {
- FileInputStream fis = null;
- StAXOMBuilder builder = null;
+ FileInputStream fis;
+ StAXOMBuilder builder;
try {
fis = new FileInputStream(configFilePath);
- builder = new StAXOMBuilder(fis);
+ builder = new StAXOMBuilder(fis);
} catch (Exception e) {
throw new TrustException("errorLoadingConfigFile",
- new String[] { configFilePath });
+ new String[]{configFilePath});
}
-
+
return load(builder.getDocumentElement());
-
+
}
-
+
public TokenIssuer getDefaultIssuerInstace() throws TrustException {
- if(this.defaultIssuerClassName != null) {
+ if (this.defaultIssuerClassName != null) {
try {
return createIssuer(this.defaultIssuerClassName);
} catch (Exception e) {
throw new TrustException("cannotLoadClass",
- new String[] { this.defaultIssuerClassName }, e);
+ new String[]{this.defaultIssuerClassName}, e);
}
} else {
return null;
}
}
-
+
public String getDefaultIssuerName() {
return this.defaultIssuerClassName;
}
-
-
+
+
public TokenIssuer getIssuer(String tokenType) throws TrustException {
String issuerClassName = null;
//try to find the isser class name from the tokenType<->issuer map
- if(this.issuers != null) {
- issuerClassName = (String)this.issuers.get(tokenType);
+ if (this.issuers != null) {
+ issuerClassName = (String) this.issuers.get(tokenType);
}
//If a specific issuer is not found use the default issuer
- if(issuerClassName == null) {
+ if (issuerClassName == null) {
issuerClassName = this.defaultIssuerClassName;
}
try {
return createIssuer(issuerClassName);
} catch (Exception e) {
throw new TrustException("cannotLoadClass",
- new String[] { this.defaultIssuerClassName }, e);
+ new String[]{this.defaultIssuerClassName}, e);
}
-
+
}
/**
* @param issuerClassName
- * @return
+ * @return TokenIssuer
*/
private TokenIssuer createIssuer(String issuerClassName) throws Exception {
TokenIssuer issuer = (TokenIssuer) Loader.loadClass(
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java?view=diff&rev=442635&r1=442634&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SAMLTokenIssuerConfig.java Tue Sep 12 09:25:08 2006
@@ -190,7 +190,8 @@
OMAttribute aliasAttr = service.getAttribute(ALIAS);
if(aliasAttr == null) {
//The certificate alias is a must
- throw new TrustException("aliasMissingForService", new String[]{service.getText().trim()});
+ throw new TrustException("aliasMissingForService",
+ new String[]{service.getText().trim()});
}
if(this.trustedServices == null) {
this.trustedServices = new HashMap();
@@ -203,9 +204,7 @@
//There maybe no trusted services as well, Therefore do not
//throw an exception when there are no trusted in the list at the
//moment
-
}
-
}
public static SAMLTokenIssuerConfig load(OMElement elem) throws TrustException {
@@ -214,8 +213,8 @@
public static SAMLTokenIssuerConfig load(String configFilePath)
throws TrustException {
- FileInputStream fis = null;
- StAXOMBuilder builder = null;
+ FileInputStream fis;
+ StAXOMBuilder builder;
try {
fis = new FileInputStream(configFilePath);
builder = new StAXOMBuilder(fis);
@@ -223,8 +222,7 @@
throw new TrustException("errorLoadingConfigFile",
new String[] { configFilePath });
}
-
- return builder != null ? load(builder.getDocumentElement()) : null;
+ return load(builder.getDocumentElement());
}
}
Modified: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java?view=diff&rev=442635&r1=442634&r2=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java (original)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/SCTIssuerConfig.java Tue Sep 12 09:25:08 2006
@@ -50,8 +50,8 @@
protected long ttl = 300000;
private SCTIssuerConfig(OMElement elem) throws TrustException {
- OMElement proofTokenElem = elem.getFirstChildWithName(
- new QName("proofToken"));
+ OMElement proofTokenElem =
+ elem.getFirstChildWithName(new QName("proofToken"));
if (proofTokenElem != null) {
this.proofTokenType = proofTokenElem.getText().trim();
}
@@ -64,11 +64,10 @@
throw new TrustException("sctIssuerCryptoPropertiesMissing");
}
- this.addRequestedAttachedRef = elem
- .getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
- this.addRequestedUnattachedRef = elem
- .getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
-
+ this.addRequestedAttachedRef =
+ elem.getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
+ this.addRequestedUnattachedRef =
+ elem.getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
this.cryptoPropertiesFile = cryptoPropertiesElem.getText().trim();
}
@@ -78,8 +77,8 @@
public static SCTIssuerConfig load(String configFilePath)
throws TrustException {
- FileInputStream fis = null;
- StAXOMBuilder builder = null;
+ FileInputStream fis;
+ StAXOMBuilder builder;
try {
fis = new FileInputStream(configFilePath);
builder = new StAXOMBuilder(fis);
@@ -88,7 +87,7 @@
new String[] { configFilePath });
}
- return builder != null ? load(builder.getDocumentElement()) : null;
+ return load(builder.getDocumentElement());
}
Added: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerConfig.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerConfig.java?view=auto&rev=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerConfig.java (added)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerConfig.java Tue Sep 12 09:25:08 2006
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rahas.impl;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.rahas.TrustException;
+
+import javax.xml.namespace.QName;
+import java.io.FileInputStream;
+
+/**
+ *
+ */
+public class TokenCancelerConfig {
+
+ /*
+ <parameter name="token-canceler-config">
+ <token-canceler-config>
+ <proofToken>EncryptedKey</proofToken>
+ <cryptoProperties>sctIssuer.properties</cryptoProperties>
+ <addRequestedAttachedRef />
+ </stoken-canceler-config>
+ </parameter>
+ */
+ public final static QName TOKEN_CANCELER_CONFIG = new QName("token-canceler-config");
+
+ private TokenCancelerConfig(OMElement elem) throws TrustException {
+ /*OMElement proofTokenElem =
+ elem.getFirstChildWithName(new QName("proofToken"));
+ if (proofTokenElem != null) {
+ this.proofTokenType = proofTokenElem.getText().trim();
+ }
+
+ OMElement cryptoPropertiesElem = elem
+ .getFirstChildWithName(new QName("cryptoProperties"));
+
+ if (!SCTIssuer.BINARY_SECRET.equals(proofTokenType)
+ && cryptoPropertiesElem == null) {
+ throw new TrustException("sctIssuerCryptoPropertiesMissing");
+ }
+
+ this.addRequestedAttachedRef = elem
+ .getFirstChildWithName(ADD_REQUESTED_ATTACHED_REF) != null;
+ this.addRequestedUnattachedRef = elem
+ .getFirstChildWithName(ADD_REQUESTED_UNATTACHED_REF) != null;
+
+ this.cryptoPropertiesFile = cryptoPropertiesElem.getText().trim();*/
+ }
+
+ public static TokenCancelerConfig load(OMElement elem) throws TrustException {
+ return new TokenCancelerConfig(elem);
+ }
+
+ public static TokenCancelerConfig load(String configFilePath)
+ throws TrustException {
+ FileInputStream fis;
+ StAXOMBuilder builder;
+ try {
+ fis = new FileInputStream(configFilePath);
+ builder = new StAXOMBuilder(fis);
+ } catch (Exception e) {
+ throw new TrustException("errorLoadingConfigFile", new String[] { configFilePath });
+ }
+ return load(builder.getDocumentElement());
+ }
+}
Added: webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerImpl.java?view=auto&rev=442635
==============================================================================
--- webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerImpl.java (added)
+++ webservices/axis2/trunk/java/modules/rahas/src/org/apache/rahas/impl/TokenCancelerImpl.java Tue Sep 12 09:25:08 2006
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rahas.impl;
+
+import org.apache.rahas.TokenCanceler;
+import org.apache.rahas.RahasData;
+import org.apache.rahas.TrustException;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.description.Parameter;
+
+/**
+ *
+ */
+public class TokenCancelerImpl implements TokenCanceler {
+
+ private String configFile;
+ private OMElement configElement;
+ private String configParamName;
+
+ /**
+ * Cancel the token specified in the request.
+ *
+ * @param data A populated <code>RahasData</code> instance
+ * @return
+ * @throws org.apache.rahas.TrustException
+ *
+ */
+ public SOAPEnvelope cancel(RahasData data) throws TrustException {
+ TokenCancelerConfig config = null;
+ if (this.configElement != null) {
+ config = TokenCancelerConfig.load(configElement.
+ getFirstChildWithName(SCTIssuerConfig.SCT_ISSUER_CONFIG));
+ }
+
+ // Look for the file
+ if (config == null && this.configFile != null) {
+ config = TokenCancelerConfig.load(this.configFile);
+ }
+
+ // Look for the param
+ if (config == null && this.configParamName != null) {
+ Parameter param = data.getInMessageContext().getParameter(this.configParamName);
+ if (param != null && param.getParameterElement() != null) {
+ config = TokenCancelerConfig.load(param.getParameterElement()
+ .getFirstChildWithName(SCTIssuerConfig.SCT_ISSUER_CONFIG));
+ } else {
+ throw new TrustException("expectedParameterMissing",
+ new String[]{this.configParamName});
+ }
+ }
+
+ if (config == null) {
+ throw new TrustException("missingConfiguration",
+ new String[]{SCTIssuerConfig.SCT_ISSUER_CONFIG
+ .getLocalPart()});
+ }
+
+ //TODO: Method implementation
+ return null;
+ }
+
+ /**
+ * Set the configuration file of this TokenCanceller.
+ * <p/>
+ * This is the text value of the <configuration-file> element of the
+ * token-dispatcher-configuration
+ *
+ * @param configFile
+ */
+ public void setConfigurationFile(String configFile) {
+ this.configFile = configFile;
+ }
+
+ /**
+ * Set the configuration element of this TokenCanceller.
+ * <p/>
+ * This is the <configuration> element of the
+ * token-dispatcher-configuration
+ *
+ * @param configElement <code>OMElement</code> representing the configuation
+ */
+ public void setConfigurationElement(OMElement configElement) {
+ this.configElement = configElement;
+ }
+
+ /**
+ * Set the name of the configuration parameter.
+ * <p/>
+ * If this is used then there must be a
+ * <code>org.apache.axis2.description.Parameter</code> object available in
+ * the via the messageContext when the <code>TokenIssuer</code> is called.
+ *
+ * @param configParamName
+ * @see org.apache.axis2.description.Parameter
+ */
+ public void setConfigurationParamName(String configParamName) {
+ this.configParamName = configParamName;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org