當前位置: 首頁>>代碼示例>>Java>>正文


Java AttributeBean類代碼示例

本文整理匯總了Java中org.apache.ws.security.saml.ext.bean.AttributeBean的典型用法代碼示例。如果您正苦於以下問題:Java AttributeBean類的具體用法?Java AttributeBean怎麽用?Java AttributeBean使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AttributeBean類屬於org.apache.ws.security.saml.ext.bean包,在下文中一共展示了AttributeBean類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAndSetStatement

import org.apache.ws.security.saml.ext.bean.AttributeBean; //導入依賴的package包/類
/**
 * Note that the SubjectBean parameter should be null for SAML2.0
 */
protected void createAndSetStatement(SubjectBean subjectBean, SAMLCallback callback) {
    if (statement == Statement.AUTHN) {
        AuthenticationStatementBean authBean = new AuthenticationStatementBean();
        if (subjectBean != null) {
            authBean.setSubject(subjectBean);
        }
        authBean.setAuthenticationMethod("Password");
        callback.setAuthenticationStatementData(Collections.singletonList(authBean));
    } else if (statement == Statement.ATTR) {
        AttributeStatementBean attrBean = new AttributeStatementBean();
        if (subjectBean != null) {
            attrBean.setSubject(subjectBean);
        }
        AttributeBean attributeBean = new AttributeBean();
        attributeBean.setSimpleName("role");
        attributeBean.setAttributeValues(Collections.singletonList("user"));
        attrBean.setSamlAttributes(Collections.singletonList(attributeBean));
        callback.setAttributeStatementData(Collections.singletonList(attrBean));
    } else {
        AuthDecisionStatementBean authzBean = new AuthDecisionStatementBean();
        if (subjectBean != null) {
            authzBean.setSubject(subjectBean);
        }
        ActionBean actionBean = new ActionBean();
        actionBean.setContents("Read");
        authzBean.setActions(Collections.singletonList(actionBean));
        authzBean.setResource("endpoint");
        authzBean.setDecision(AuthDecisionStatementBean.Decision.PERMIT);
        callback.setAuthDecisionStatementData(Collections.singletonList(authzBean));
    }
}
 
開發者ID:jaminh,項目名稱:spring-saml-example-war,代碼行數:35,代碼來源:AbstractSAMLCallbackHandler.java

示例2: handle

import org.apache.ws.security.saml.ext.bean.AttributeBean; //導入依賴的package包/類
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];
         if (this.saml2)
         {
            callback.setSamlVersion(SAMLVersion.VERSION_20);
         }
         callback.setIssuer("sts");
         String subjectName = "uid=sts-client,o=jbws-cxf-sts.com";
         String subjectQualifier = "www.jbws-cxf-sts.org";

         SubjectBean subjectBean = new SubjectBean(subjectName, subjectQualifier, this.confirmationMethod);
         if (SAML2Constants.CONF_HOLDER_KEY.equals(this.confirmationMethod)
               || SAML1Constants.CONF_HOLDER_KEY.equals(this.confirmationMethod))
         {
            try
            {
               KeyInfoBean keyInfo = createKeyInfo();
               subjectBean.setKeyInfo(keyInfo);
            }
            catch (Exception ex)
            {
               throw new IOException("Problem creating KeyInfo: " + ex.getMessage());
            }
         }

         callback.setSubject(subjectBean);

         AttributeStatementBean attrBean = new AttributeStatementBean();
         attrBean.setSubject(subjectBean);

         AttributeBean attributeBean = new AttributeBean();
         if (this.saml2)
         {
            attributeBean.setQualifiedName("subject-role");
         }
         else
         {
            attributeBean.setSimpleName("subject-role");
            attributeBean.setQualifiedName("http://custom-ns");
         }
         attributeBean.setAttributeValues(Collections.singletonList("system-user"));
         attrBean.setSamlAttributes(Collections.singletonList(attributeBean));
         callback.setAttributeStatementData(Collections.singletonList(attrBean));
      }
   }
}
 
開發者ID:rareddy,項目名稱:ws-security-examples,代碼行數:52,代碼來源:SamlCallbackHandler.java

示例3: handle

import org.apache.ws.security.saml.ext.bean.AttributeBean; //導入依賴的package包/類
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];
            if (this.saml2)
            {
                callback.setSamlVersion(SAMLVersion.VERSION_20);
            }
            callback.setIssuer("sts");
            String subjectName = "uid=sts-client,o=jbws-cxf-sts.com";
            String subjectQualifier = "www.jbws-cxf-sts.org";

            SubjectBean subjectBean = new SubjectBean(subjectName, subjectQualifier, this.confirmationMethod);
            if (SAML2Constants.CONF_HOLDER_KEY.equals(this.confirmationMethod)
                    || SAML1Constants.CONF_HOLDER_KEY.equals(this.confirmationMethod))
            {
                try
                {
                    KeyInfoBean keyInfo = createKeyInfo();
                    subjectBean.setKeyInfo(keyInfo);
                }
                catch (Exception ex)
                {
                    throw new IOException("Problem creating KeyInfo: " + ex.getMessage());
                }
            }

            callback.setSubject(subjectBean);

            AttributeStatementBean attrBean = new AttributeStatementBean();
            attrBean.setSubject(subjectBean);

            AttributeBean attributeBean = new AttributeBean();
            if (this.saml2)
            {
                attributeBean.setQualifiedName("subject-role");
            }
            else
            {
                attributeBean.setSimpleName("subject-role");
                attributeBean.setQualifiedName("http://custom-ns");
            }
            attributeBean.setAttributeValues(Collections.singletonList("system-user"));
            attrBean.setSamlAttributes(Collections.singletonList(attributeBean));
            callback.setAttributeStatementData(Collections.singletonList(attrBean));
        }
    }
}
 
開發者ID:windup,項目名稱:windup-rulesets,代碼行數:52,代碼來源:SamlCallbackHandler.java


注:本文中的org.apache.ws.security.saml.ext.bean.AttributeBean類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。