本文整理汇总了Java中org.apache.neethi.Assertion类的典型用法代码示例。如果您正苦于以下问题:Java Assertion类的具体用法?Java Assertion怎么用?Java Assertion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Assertion类属于org.apache.neethi包,在下文中一共展示了Assertion类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCarbonSecConfigs
import org.apache.neethi.Assertion; //导入依赖的package包/类
private OMElement getCarbonSecConfigs(Policy policy) {
if (log.isDebugEnabled() && policy != null) {
log.debug("Retrieving carbonSecConfigs from policy id : " + policy.getId());
}
if (policy != null) {
List it = (List) policy.getAlternatives().next();
for (Iterator iter = it.iterator(); iter.hasNext(); ) {
Assertion assertion = (Assertion) iter.next();
if (assertion instanceof XmlPrimtiveAssertion) {
OMElement xmlPrimitiveAssertion = (((XmlPrimtiveAssertion) assertion).getValue());
if (SecurityConstants.CARBON_SEC_CONFIG.equals(xmlPrimitiveAssertion.getLocalName())) {
OMElement carbonSecConfigElement = (((XmlPrimtiveAssertion) assertion).getValue());
if (log.isDebugEnabled()) {
log.debug("carbonSecConfig : " + carbonSecConfigElement.toString());
}
return carbonSecConfigElement;
}
}
}
}
return null;
}
示例2: handleMessage
import org.apache.neethi.Assertion; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void handleMessage(Message message) throws Fault {
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
if (aim != null) {
// http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/ws-securitypolicy-1.2-spec-os.html#_Toc161826515
Collection<AssertionInfo> ais = aim.getAssertionInfo(SP12Constants.ENCRYPTED_PARTS);
if (ais != null) {
for (AssertionInfo ai : ais) {
Assertion a = ai.getAssertion();
if (a instanceof SignedEncryptedParts) {
SignedEncryptedParts sep = (SignedEncryptedParts)a;
if (!sep.isIgnorable() && !sep.isOptional()) {
InboundHandler.getCredentials().add(new ConfidentialityCredential(true));
break;
}
}
}
}
}
}
示例3: handleMessage
import org.apache.neethi.Assertion; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void handleMessage(Message message) throws Fault {
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
if (aim != null) {
// http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/ws-securitypolicy-1.2-spec-os.html#_Toc161826515
Collection<AssertionInfo> ais = aim.getAssertionInfo(SP12Constants.ENCRYPTED_PARTS);
if (ais != null) {
for (AssertionInfo ai : ais) {
Assertion a = ai.getAssertion();
if (a instanceof EncryptedParts) {
EncryptedParts sep = (EncryptedParts)a;
if (!sep.isIgnorable() && !sep.isOptional()) {
InboundHandler.getCredentials().add(new ConfidentialityCredential(true));
break;
}
}
}
}
}
}
示例4: testSymmBinding
import org.apache.neethi.Assertion; //导入依赖的package包/类
public void testSymmBinding() {
try {
Policy p = this.getPolicy(System.getProperty("basedir", ".") +
"/test-resources/policy-mtom-security.xml");
List assertions = (List)p.getAlternatives().next();
boolean isMTOMAssertionFound = false;
for (Iterator iter = assertions.iterator(); iter.hasNext();) {
Assertion assertion = (Assertion)iter.next();
if (assertion instanceof MTOM10Assertion) {
isMTOMAssertionFound = true;
MTOM10Assertion mtomModel = (MTOM10Assertion)assertion;
assertEquals("MIME Serialization assertion not processed", false,
mtomModel.isOptional());
}
}
//The Asymm binding mean is not built in the policy processing :-(
assertTrue("MTOM10 Assertion not found.", isMTOMAssertionFound);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例5: testMTOM10Optional
import org.apache.neethi.Assertion; //导入依赖的package包/类
public void testMTOM10Optional() {
//Testing the wsp:Optional attribute in WS-MTOMPolicy 1.0 assertion
try {
Policy p = this.getPolicy(System.getProperty("basedir", ".") +
"/test-resources/policy-mtom-optional.xml");
List assertions = (List)p.getAlternatives().next();
for (Iterator iter = assertions.iterator(); iter.hasNext();) {
Assertion assertion = (Assertion)iter.next();
if (assertion instanceof MTOM10Assertion) {
MTOM10Assertion mtomModel = (MTOM10Assertion)assertion;
assertEquals("wsp:Optional attribute is not processed", true,
mtomModel.isOptional());
}
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例6: testMTOM11Assertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
public void testMTOM11Assertion () {
// Testing the WS-MTOMPolicy 1.1 assertion
try {
Policy p = this.getPolicy(System.getProperty("basedir", ".") +
"/test-resources/policy-mtom11.xml");
List assertions = (List)p.getAlternatives().next();
boolean isMTOMAssertionFound = false;
for (Iterator iter = assertions.iterator(); iter.hasNext();) {
Assertion assertion = (Assertion)iter.next();
if (assertion instanceof MTOM11Assertion) {
isMTOMAssertionFound = true;
MTOM11Assertion mtomModel = (MTOM11Assertion)assertion;
}
}
assertTrue("MTOM11 Assertion not found.", isMTOMAssertionFound);
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例7: testMTOM11AssertionOptional
import org.apache.neethi.Assertion; //导入依赖的package包/类
public void testMTOM11AssertionOptional() {
//Testing the wsp:Optional attribute in WS-MTOMPolicy 1.0 assertion
try {
Policy p = this.getPolicy(System.getProperty("basedir", ".") +
"/test-resources/policy-mtom11-optional.xml");
List assertions = (List)p.getAlternatives().next();
for (Iterator iter = assertions.iterator(); iter.hasNext();) {
Assertion assertion = (Assertion)iter.next();
if (assertion instanceof MTOM10Assertion) {
MTOM10Assertion mtomModel = (MTOM10Assertion)assertion;
assertEquals("wsp:Optional attribute is not processed", true,
mtomModel.isOptional());
}
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
示例8: invoke
import org.apache.neethi.Assertion; //导入依赖的package包/类
/**
* Checks if the message should be MTOMised. If it is not but the policy states that it should be </br>
* then an {@link AxisFault} is thrown.
*
* @param msgCtx the {@link MessageContext}
*
* @throws AxisFault if the message is not MTOMised, but the policy states so.
*/
public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault {
Policy policy = msgCtx.getEffectivePolicy();
if (policy == null) {
return InvocationResponse.CONTINUE;
}
List<Assertion> list = (List<Assertion>) policy.getAlternatives()
.next();
for (Assertion assertion : list) {
if (assertion instanceof MTOMAssertion) {
String contentType = (String) msgCtx.getProperty(Constants.Configuration.CONTENT_TYPE);
if (!assertion.isOptional()) {
if (contentType == null || contentType.indexOf(MTOMConstants.MTOM_TYPE) == -1) {
if (msgCtx.isServerSide()) {
throw new AxisFault(
"The SOAP REQUEST sent by the client IS NOT MTOMized!");
} else {
throw new AxisFault(
"The SOAP RESPONSE sent by the service IS NOT MTOMized!");
}
}
}
}
}
return InvocationResponse.CONTINUE;
}
示例9: canSupportAssertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
private boolean canSupportAssertion(Assertion assertion, List<AxisModule> moduleList) {
Module module;
for (AxisModule axisModule : moduleList) {
// FIXME is this step really needed ??
// Shouldn't axisMoudle.getModule always return not-null value ??
module = axisModule.getModule();
if (!(module == null || module.canSupportAssertion(assertion))) {
log.debug(axisModule.getName() + " says it can't support " + assertion.getName());
return false;
}
}
return true;
}
示例10: getRampartConfigs
import org.apache.neethi.Assertion; //导入依赖的package包/类
private RampartConfig getRampartConfigs(Policy policy) {
if (policy != null) {
if (log.isDebugEnabled()) {
log.debug("Retrieving RampartConfigs from policy with id : " + policy.getId());
}
List it = (List) policy.getAlternatives().next();
for (Iterator iter = it.iterator(); iter.hasNext(); ) {
Assertion assertion = (Assertion) iter.next();
if (assertion instanceof RampartConfig) {
return (RampartConfig) assertion;
}
}
}
return null;
}
示例11: canSupportAssertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
public boolean canSupportAssertion(Assertion assertion) {
if (log.isDebugEnabled()) {
log.debug("canSupportAssertion called on MTOMPolicy module with "
+ assertion.getName().toString() + " assertion");
}
if (assertion instanceof MTOMAssertion) {
return true;
}
return false;
}
示例12: invoke
import org.apache.neethi.Assertion; //导入依赖的package包/类
/**
* Checks the effective policy set and based on it the <code>enableMTOM</code> is set to the appropriate value.</br>
* E.g. if the policy states that MTOM is <code>optional</code> then the <code>enableMTOM</code> is set to this value.
*
* @param msgCtx the {@link MessageContext}
*
* @throws AxisFault
*/
public InvocationResponse invoke(MessageContext msgCtx) throws AxisFault {
Policy policy = msgCtx.getEffectivePolicy();
if (policy == null) {
return InvocationResponse.CONTINUE;
}
// TODO When we have policy alternatives support we will have to change
// the implementation.
List<Assertion> list = (List<Assertion>) policy.getAlternatives().next();
for (Assertion assertion : list) {
if (assertion instanceof MTOMAssertion) {
boolean isOptional = assertion.isOptional();
if (isOptional) {
msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM,
Constants.VALUE_OPTIONAL);
} else {
msgCtx.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
}
}
}
return InvocationResponse.CONTINUE;
}
示例13: getMTOMAssertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
/**
* Extracts the MTOM assertion object if it is exists into the policy based on a given {@link AxisDescription}.
*
* @param axisDescription the {@link AxisDescription} object that should be searched.
* @return {@link MTOMAssertion} the {@link MTOMAssertion} found. If it is not found "null" is returned.
*/
public static MTOMAssertion getMTOMAssertion(AxisDescription axisDescription) {
if (axisDescription == null) {
if (log.isDebugEnabled()) {
log.debug("AxisDescription passed as parameter has a \"null\" value.");
}
return null;
}
ArrayList policyList = new ArrayList();
policyList.addAll(axisDescription.getPolicySubject()
.getAttachedPolicyComponents());
Policy policy = PolicyUtil.getMergedPolicy(policyList, axisDescription);
if (policy == null) {
return null;
}
List<Assertion> list = (List<Assertion>) policy.getAlternatives()
.next();
for (Assertion assertion : list) {
if (assertion instanceof MTOMAssertion) {
return (MTOMAssertion) assertion;
}
}
return null;
}
示例14: canSupportAssertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
@Override
public boolean canSupportAssertion(Assertion assertion) {
return true;
}
示例15: canSupportAssertion
import org.apache.neethi.Assertion; //导入依赖的package包/类
@Override
public boolean canSupportAssertion(final Assertion asrtn) {
return false;
}