HOKSAMLAssertionBuilder extends SAMLAssertionBuilder { protected List<AttributeStatement> createAcpAttributeStatements(CallbackProperties properties) { List<AttributeStatement> statements = new ArrayList<>(); Attribute acpAttribute; Attribute iacpAttribute; final String acp = properties.getAcpAttribute(); final String iacp = properties.getIacpAttribute(); if (StringUtils.isNotEmpty(acp)) { acpAttribute = componentBuilder .createAttribute(SamlConstants.ATTRIBUTE_FRIENDLY_NAME_XUA_ACP, SamlConstants.ATTRIBUTE_NAME_XUA_ACP, SamlConstants.URI_NAME_FORMAT); acpAttribute.getAttributeValues().add(componentBuilder.createUriAttributeValue(acp)); statements.add(componentBuilder.createAttributeStatement(acpAttribute)); } if (StringUtils.isNotEmpty(iacp)) { iacpAttribute = componentBuilder .createAttribute(SamlConstants.ATTRIBUTE_FRIENDLY_NAME_XUA_IACP, SamlConstants.ATTRIBUTE_NAME_XUA_IACP, SamlConstants.URI_NAME_FORMAT); iacpAttribute.getAttributeValues().add(componentBuilder.createUriAttributeValue(iacp)); statements.add(componentBuilder.createAttributeStatement(iacpAttribute)); } return statements; } HOKSAMLAssertionBuilder();   HOKSAMLAssertionBuilder(final CertificateManager certificateManager); @Override Element build(final CallbackProperties properties, String certificateAlias); List<Statement> createAttributeStatements(final CallbackProperties properties, final Subject subject); void addOptionalStatement(List<Statement> statements, Statement statement); void addOptionalAttributeStatements(List<Statement> statements, List<AttributeStatement> statementList); AuthnStatement createAuthenicationStatements(final CallbackProperties properties); AuthzDecisionStatement createAuthorizationDecisionStatement(final CallbackProperties properties,
        final Subject subject); Evidence createEvidence(final CallbackProperties properties, final Subject subject); Evidence buildEvidence(CallbackProperties properties, List<AttributeStatement> statements, Subject subject); AttributeStatement createSubjectIdAttributeStatement(final CallbackProperties properties); static String appendPrefixHomeCommunityID(final String homeCommunityId); static String checkPrefixBeforeAppend(final String checkValue, final String checkPrefix); static List<Object> checkHcidPrefixInList(final List<Object> valueList);  }
@Test public void testCreateAcpAttributeStatement() { final CallbackProperties callbackProps = mock(CallbackProperties.class); final HOKSAMLAssertionBuilder builder = new HOKSAMLAssertionBuilder(); final String acp = "urn:oid:1.2.3.4"; final String iacp = "urn:oid:1.2.3.4.5"; when(callbackProps.getAcpAttribute()).thenReturn(acp); when(callbackProps.getIacpAttribute()).thenReturn(iacp); List<AttributeStatement> aStatement = builder.createAcpAttributeStatements(callbackProps); assertNotNull(aStatement); assertEquals(2, aStatement.size()); boolean containsAcps = true; for(int i=0; i<2; i++) { XSAny xsValue = (XSAny) aStatement.get(i).getAttributes().get(0).getAttributeValues().get(0); if(!(acp.equals(xsValue.getTextContent()) || iacp.equals(xsValue.getTextContent()))) { containsAcps = false; break; } } assertTrue(containsAcps); }