| Method from org.apache.rahas.client.STSClient Detail: |
public boolean cancelToken(String issuerAddress,
String tokenId,
String action) throws TrustException {
try {
QName rstQn = new QName("cancelSecurityToken");
ServiceClient client = getServiceClient(rstQn, issuerAddress);
if(action != null) {
client.getOptions().setAction(action);
}
return processCancelResponse(client.sendReceive(rstQn,
createCancelRequest(tokenId)));
} catch (AxisFault e) {
log.error("errorInCancelingToken", e);
throw new TrustException("errorInCancelingToken", e);
}
}
Cancel a particular security token |
public boolean renewToken(String tokenId,
String issuerAddress,
Policy issuerPolicy) throws TrustException {
try {
QName rstQn = new QName("requestSecurityToken");
ServiceClient client = getServiceClient(rstQn, issuerAddress);
client.getServiceContext().setProperty(RAMPART_POLICY, issuerPolicy);
client.getOptions().setSoapVersionURI(this.soapVersion);
if(this.addressingNs != null) {
client.getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, this.addressingNs);
}
client.engageModule("addressing");
client.engageModule("rampart");
this.processPolicy(issuerPolicy, null);
String tokenType = RahasConstants.TOK_TYPE_SAML_10;
OMElement response = client.sendReceive(rstQn,
createRenewRequest(tokenType,tokenId));
return true;
} catch (AxisFault e) {
log.error("errorInRenewingToken", e);
throw new TrustException("errorInRenewingToken", new String[]{issuerAddress});
}
}
|
public Token requestSecurityToken(Policy servicePolicy,
String issuerAddress,
Policy issuerPolicy,
String appliesTo) throws TrustException {
try {
QName rstQn = new QName("requestSecurityToken");
String requestType =
TrustUtil.getWSTNamespace(version) + RahasConstants.REQ_TYPE_ISSUE;
ServiceClient client = getServiceClient(rstQn, issuerAddress);
client.getServiceContext().setProperty(RAMPART_POLICY, issuerPolicy);
client.getOptions().setSoapVersionURI(this.soapVersion);
if(this.addressingNs != null) {
client.getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, this.addressingNs);
}
client.engageModule("addressing");
client.engageModule("rampart");
//Process the STS and service policy policy
this.processPolicy(issuerPolicy, servicePolicy);
OMElement response = client.sendReceive(rstQn,
createIssueRequest(requestType, appliesTo));
return processIssueResponse(version, response, issuerAddress);
} catch (AxisFault e) {
e.printStackTrace();
log.error("errorInObtainingToken", e);
throw new TrustException("errorInObtainingToken", new String[]{issuerAddress});
}
}
|
public void setAction(String action) {
this.action = action;
}
|
public void setAddressingNs(String addressingNs) {
this.addressingNs = addressingNs;
}
|
public void setAlgorithmSuite(AlgorithmSuite algorithmSuite) {
this.algorithmSuite = algorithmSuite;
}
This can be used in the case where the AlgorithmSuite is not specified in
the given policy.
If the AlgorithmSuite exists in a binding in the policy then the value
set will be overridden. |
public void setCryptoInfo(Crypto crypto,
CallbackHandler cbHandler) {
this.crypto = crypto;
this.cbHandler = cbHandler;
}
Sets the crypto information required to process the RSTR. |
public void setCryptoInfo(Crypto crypto,
String privKeyPasswd) {
this.crypto = crypto;
this.cbHandler = new CBHandler(privKeyPasswd);
}
Sets the crypto information required to process the RSTR. |
public void setOptions(Options options) {
this.options = options;
}
|
public void setRstTemplate(OMElement rstTemplate) {
this.rstTemplate = rstTemplate;
}
|
public void setSoapVersion(String soapVersion) {
this.soapVersion = soapVersion;
}
|
public void setTrust10(Trust10 trust10) {
this.trust10 = trust10;
}
Set this to set the entropy configurations.
If this is provided in the given policy it will be overridden. |
public void setTtl(int ttl) {
this.ttl = ttl;
}
|
public void setVersion(int version) {
this.version = version;
}
|
public boolean validateToken(String tokenId,
String issuerAddress,
Policy issuerPolicy) throws TrustException {
try {
QName rstQn = new QName("requestSecurityToken");
String requestType =
TrustUtil.getWSTNamespace(version) + RahasConstants.REQ_TYPE_VALIDATE;
ServiceClient client = getServiceClient(rstQn, issuerAddress);
client.getServiceContext().setProperty(RAMPART_POLICY, issuerPolicy);
client.getOptions().setSoapVersionURI(this.soapVersion);
if(this.addressingNs != null) {
client.getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION, this.addressingNs);
}
client.engageModule("addressing");
client.engageModule("rampart");
this.processPolicy(issuerPolicy, null);
OMElement response = client.sendReceive(rstQn,
createValidateRequest(requestType,tokenId));
System.out.println(response.toString());
return true;
} catch (AxisFault e) {
log.error("errorInValidatingToken", e);
throw new TrustException("errorInValidatingToken", new String[]{issuerAddress});
}
}
|