public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (int i = 0; i < callbacks.length; i++) { if (callbacks[i] instanceof SAMLCallback) { SAMLCallback callback = (SAMLCallback) callbacks[i]; callback.setSamlVersion(SAMLVersion.VERSION_20); callback.setIssuer("alice"); String subjectName = "uid=auth_client"; SubjectBean subjectBean = new SubjectBean( subjectName, null, SAML2Constants.CONF_SENDER_VOUCHES ); callback.setSubject(subjectBean); AttributeStatementBean attrBean = new AttributeStatementBean(); if (subjectBean != null) { attrBean.setSubject(subjectBean); } AttributeBean attributeBean = new AttributeBean(); attributeBean.setQualifiedName("attribute-role"); attributeBean.setAttributeValues(Collections.singletonList((Object)"authenticated-client")); attrBean.setSamlAttributes(Collections.singletonList(attributeBean)); callback.setAttributeStatementData(Collections.singletonList(attrBean)); } } }
/** * For SAML 1.1 default to setting the SubjectBean on the statements if they * don't already have a Subject defined. */ private void setSubjectOnBeans() { if (attributeBeans != null) { for (AttributeStatementBean attributeBean : attributeBeans) { if (attributeBean.getSubject() == null) { attributeBean.setSubject(subjectBean); } } } if (authBeans != null) { for (AuthenticationStatementBean authBean : authBeans) { if (authBean.getSubject() == null) { authBean.setSubject(subjectBean); } } } if (authDecisionBeans != null) { for (AuthDecisionStatementBean authDecisionBean : authDecisionBeans) { if (authDecisionBean.getSubject() == null) { authDecisionBean.setSubject(subjectBean); } } } }
/** * For SAML 1.1 default to setting the SubjectBean on the statements if they * don't already have a Subject defined. */ private void setSubjectOnBeans() { if (attributeBeans != null) { for (AttributeStatementBean attributeBean : attributeBeans) { if (attributeBean.getSubject() == null) { attributeBean.setSubject(subjectBean); } } } if (authBeans != null) { for (AuthenticationStatementBean authBean : authBeans) { if (authBean.getSubject() == null) { authBean.setSubject(subjectBean); } } } if (authDecisionBeans != null) { for (AuthDecisionStatementBean authDecisionBean : authDecisionBeans) { if (authDecisionBean.getSubject() == null) { authDecisionBean.setSubject(subjectBean); } } } }
AttributeStatementBean defaultStatement = new DefaultAttributeStatementProvider().getStatement(tokenParameters); defaultStatement.setSubject(subjectBean); samlCallback.setAttributeStatementData(Collections.singletonList(defaultStatement));
AttributeStatementBean defaultStatement = new DefaultAttributeStatementProvider().getStatement(tokenParameters); defaultStatement.setSubject(subjectBean); samlCallback.setAttributeStatementData(Collections.singletonList(defaultStatement));
attrBean.setSubject(subjectBean);
attrBean.setSubject(subjectBean);
attrBean.setSubject(subjectBean);
attrBean.setSubject(subjectBean);
attrBean.setSubject(subjectBean);
attrBean.setSubject(subjectBean);