public static boolean isThereAnAssertionByLocalname( AssertionInfoMap aim, String localname ) { Collection<AssertionInfo> sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); Collection<AssertionInfo> sp12Ais = aim.get(new QName(SP12Constants.SP_NS, localname)); return (sp11Ais != null && !sp11Ais.isEmpty()) || (sp12Ais != null && !sp12Ais.isEmpty()); }
public static boolean isThereAnAssertionByLocalname( AssertionInfoMap aim, String localname ) { Collection<AssertionInfo> sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); Collection<AssertionInfo> sp12Ais = aim.get(new QName(SP12Constants.SP_NS, localname)); return (sp11Ais != null && !sp11Ais.isEmpty()) || (sp12Ais != null && !sp12Ais.isEmpty()); }
public static AssertionInfo getFirstAssertionByLocalname( AssertionInfoMap aim, String localname ) { Collection<AssertionInfo> sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); if (sp11Ais != null && !sp11Ais.isEmpty()) { return sp11Ais.iterator().next(); } Collection<AssertionInfo> sp12Ais = aim.get(new QName(SP12Constants.SP_NS, localname)); if (sp12Ais != null && !sp12Ais.isEmpty()) { return sp12Ais.iterator().next(); } return null; }
public static AssertionInfo getFirstAssertionByLocalname( AssertionInfoMap aim, String localname ) { Collection<AssertionInfo> sp11Ais = aim.get(new QName(SP11Constants.SP_NS, localname)); if (sp11Ais != null && !sp11Ais.isEmpty()) { return sp11Ais.iterator().next(); } Collection<AssertionInfo> sp12Ais = aim.get(new QName(SP12Constants.SP_NS, localname)); if (sp12Ais != null && !sp12Ais.isEmpty()) { return sp12Ais.iterator().next(); } return null; }
public Collection<AssertionInfo> getAssertionInfo(QName name) { Collection<AssertionInfo> ail = get(name); return ail != null ? ail : CastUtils.cast(Collections.EMPTY_LIST, AssertionInfo.class); }
private void unassertPolicy(AssertionInfoMap aim, QName q, String msg) { Collection<AssertionInfo> ais = aim.get(q); if (ais != null && !ais.isEmpty()) { for (AssertionInfo ai : ais) { ai.setNotAsserted(msg); } } }
private void unassertPolicy(AssertionInfoMap aim, QName q, String msg) { Collection<AssertionInfo> ais = aim.get(q); if (ais != null && !ais.isEmpty()) { for (AssertionInfo ai : ais) { ai.setNotAsserted(msg); } } }
public Collection<AssertionInfo> getAssertionInfo(QName name) { Collection<AssertionInfo> ail = get(name); return ail != null ? ail : CastUtils.cast(Collections.EMPTY_LIST, AssertionInfo.class); }
/** * Determine if the use of addressing is indicated by an Addressing assertion in the * alternative chosen for the current message. * * @param message the current message * @pre message is outbound * @pre requestor role */ private boolean hasAddressingAssertion(Message message) { AssertionInfoMap aim = message.get(AssertionInfoMap.class); if (null == aim) { return false; } return null != aim.get(MetadataConstants.ADDRESSING_ASSERTION_QNAME); }
protected void assertSecurePartsIfTokenNotRequired( AbstractSecurityAssertion securedPart, QName name, AssertionInfoMap aim ) { Collection<AssertionInfo> ais = aim.get(name); if (ais != null && !ais.isEmpty()) { for (AssertionInfo ai : ais) { if (ai.getAssertion().equals(securedPart)) { ai.setAsserted(true); } } } } public boolean isEnforceEncryptedTokens() {
protected void assertSecurePartsIfTokenNotRequired( AbstractSecurityAssertion securedPart, QName name, AssertionInfoMap aim ) { Collection<AssertionInfo> ais = aim.get(name); if (ais != null && !ais.isEmpty()) { for (AssertionInfo ai : ais) { if (ai.getAssertion().equals(securedPart)) { ai.setAsserted(true); } } } } public boolean isEnforceEncryptedTokens() {
protected void confirmPolicyProcessing(Message message) { AssertionInfoMap aim = message.get(AssertionInfoMap.class); if (aim != null) { Collection<AssertionInfo> ais = aim .get(CompressionPolicyBuilder.COMPRESSION); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() instanceof CompressionAssertion) { ai.setAsserted(true); } } } } }
private <T> List<T> getPoliciesFromMessage(QName name, Message message, Class<T> dataClass) { List<T> policies = new ArrayList<>(); AssertionInfoMap amap = message.get(AssertionInfoMap.class); if (null == amap || amap.isEmpty()) { return policies; } Collection<AssertionInfo> ais = amap.get(name); if (null == ais) { return policies; } for (AssertionInfo ai : ais) { T policy = JaxbAssertion.cast(ai.getAssertion(), dataClass).getData(); policies.add(policy); } return policies; }
protected void confirmPolicyProcessing(Message message) { AssertionInfoMap aim = message.get(AssertionInfoMap.class); if (aim != null) { Collection<AssertionInfo> ais = aim .get(TransformationPolicyBuilder.TRANSFORMATION); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() instanceof TransformationAssertion) { ai.setAsserted(true); } } } } } }
private void confirmPolicyProcessing(Message message) { AssertionInfoMap aim = message.get(AssertionInfoMap.class); if (aim != null) { Collection<AssertionInfo> ais = aim .get(TransformationPolicyBuilder.TRANSFORMATION); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() instanceof TransformationAssertion) { ai.setAsserted(true); } } } } }
protected void policyNotAsserted(AbstractToken assertion, Exception reason, SoapMessage message) { if (assertion == null) { return; } AssertionInfoMap aim = message.get(AssertionInfoMap.class); Collection<AssertionInfo> ais = aim.get(assertion.getName()); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() == assertion) { ai.setNotAsserted(reason.getMessage()); } } } throw new PolicyException(reason); }
protected void policyNotAsserted(AbstractToken assertion, Exception reason, SoapMessage message) { if (assertion == null) { return; } AssertionInfoMap aim = message.get(AssertionInfoMap.class); Collection<AssertionInfo> ais = aim.get(assertion.getName()); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() == assertion) { ai.setNotAsserted(reason.getMessage()); } } } throw new PolicyException(reason); }
public Credential validate(Credential credential, RequestData data) throws WSSecurityException { Credential validatedCredential = super.validate(credential, data); // Assert the IssuedToken policy SoapMessage message = (SoapMessage)data.getMsgContext(); AssertionInfoMap aim = message.get(AssertionInfoMap.class); Collection<AssertionInfo> ais = aim.get(SP12Constants.ISSUED_TOKEN); for (AssertionInfo ai : ais) { ai.setAsserted(true); } return validatedCredential; }
protected void policyNotAsserted(AbstractToken assertion, String reason, SoapMessage message) { if (assertion == null) { return; } AssertionInfoMap aim = message.get(AssertionInfoMap.class); Collection<AssertionInfo> ais = aim.get(assertion.getName()); if (ais != null) { for (AssertionInfo ai : ais) { if (ai.getAssertion() == assertion) { ai.setNotAsserted(reason); } } } if (!assertion.isOptional()) { throw new PolicyException(new Message(reason, LOG)); } }
public <T> void assertMessage(Message message, T confPol, PolicyCalculator<T> policyCalculator) { T messagePol = message.get(policyCalculator.getDataClass()); final T refPolicy = (messagePol != null) ? policyCalculator.intersect(messagePol, confPol) : confPol; AssertionInfoMap amap = message.get(AssertionInfoMap.class); if (null == amap || amap.isEmpty()) { return; } Collection<AssertionInfo> ais = amap.get(policyCalculator.getDataClassName()); if (ais == null) { return; } for (AssertionInfo ai : ais) { T policy = JaxbAssertion.cast(ai.getAssertion(), policyCalculator.getDataClass()).getData(); ai.setAsserted(policyCalculator.isAsserted(message, policy, refPolicy)); } }