HOKSAMLAssertionBuilder extends SAMLAssertionBuilder { public Evidence buildEvidence(CallbackProperties properties, List<AttributeStatement> statements, Subject subject) { DateTime issueInstant = properties.getEvidenceInstant(); String format = properties.getEvidenceIssuerFormat(); String evAssertionID = properties.getEvidenceID(); DateTime beginValidTime = properties.getEvidenceConditionNotBefore(); DateTime endValidTime = properties.getEvidenceConditionNotAfter(); final List<Assertion> evidenceAssertions = new ArrayList<>(); if (evAssertionID == null) { evAssertionID = createAssertionId(); } else if (!evAssertionID.startsWith("_")) { evAssertionID = ID_PREFIX.concat(evAssertionID); } if (issueInstant == null) { issueInstant = new DateTime(); } if (!isValidIssuerFormat(format)) { format = X509_NAME_ID; } final Issuer evIssuerId = componentBuilder.createIssuer(format, properties.getEvidenceIssuer()); final Assertion evidenceAssertion = componentBuilder.createAssertion(evAssertionID); evidenceAssertion.getAttributeStatements().addAll(statements); if (beginValidTime != null && endValidTime != null) { if (isConditionsDefaultValueEnabled() || beginValidTime.isAfter(endValidTime)) { beginValidTime = setBeginValidTime(beginValidTime, issueInstant); endValidTime = setEndValidTime(endValidTime, issueInstant); } final Conditions conditions = componentBuilder.createConditions(beginValidTime, endValidTime); evidenceAssertion.setConditions(conditions); } evidenceAssertion.setIssueInstant(issueInstant); evidenceAssertion.setIssuer(evIssuerId); evidenceAssertion.setSubject(subject); evidenceAssertions.add(evidenceAssertion); final Evidence evidence = componentBuilder.createEvidence(evidenceAssertions); LOG.debug("SamlCallbackHandler.createEvidence() -- End"); return evidence; } 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 testBuildEvidence() { Map<String, Object> propertiesMap = new HashMap<String, Object>(); propertiesMap.put(SamlConstants.EVIDENCE_ID_PROP, "_45678fdgrt543sweqt"); CallbackProperties properties = new CallbackMapProperties(propertiesMap); final HOKSAMLAssertionBuilder builder = new HOKSAMLAssertionBuilder(); final Subject subject = mock(Subject.class); final AttributeStatement e = mock(AttributeStatement.class); final List<AttributeStatement> statements = new ArrayList<>(); statements.add(0, e); final Evidence evidence1 = builder.buildEvidence(properties, statements, subject); assertTrue(evidence1.getAssertions().get(0).getID().startsWith("_")); }