当前位置: 首页>>代码示例>>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;未经允许,请勿转载。