• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NameIDPolicy类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.opensaml.saml2.core.NameIDPolicy的典型用法代码示例。如果您正苦于以下问题:Java NameIDPolicy类的具体用法?Java NameIDPolicy怎么用?Java NameIDPolicy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NameIDPolicy类属于org.opensaml.saml2.core包,在下文中一共展示了NameIDPolicy类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: processChildElement

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    NameIDMappingRequest req = (NameIDMappingRequest) parentSAMLObject;

    if (childSAMLObject instanceof BaseID) {
        req.setBaseID((BaseID) childSAMLObject);
    } else if (childSAMLObject instanceof NameID) {
        req.setNameID((NameID) childSAMLObject);
    } else if (childSAMLObject instanceof EncryptedID) {
        req.setEncryptedID((EncryptedID) childSAMLObject);
    } else if (childSAMLObject instanceof NameIDPolicy) {
        req.setNameIDPolicy((NameIDPolicy) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:NameIDMappingRequestUnmarshaller.java


示例2: processChildElement

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    AuthnRequest req = (AuthnRequest) parentSAMLObject;

    if (childSAMLObject instanceof Subject) {
        req.setSubject((Subject) childSAMLObject);
    } else if (childSAMLObject instanceof NameIDPolicy) {
        req.setNameIDPolicy((NameIDPolicy) childSAMLObject);
    } else if (childSAMLObject instanceof Conditions) {
        req.setConditions((Conditions) childSAMLObject);
    } else if (childSAMLObject instanceof RequestedAuthnContext) {
        req.setRequestedAuthnContext((RequestedAuthnContext) childSAMLObject);
    } else if (childSAMLObject instanceof Scoping) {
        req.setScoping((Scoping) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:AuthnRequestUnmarshaller.java


示例3: marshallAttributes

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    NameIDPolicy policy = (NameIDPolicy) samlObject;

    if (policy.getFormat() != null) {
        domElement.setAttributeNS(null, NameIDPolicy.FORMAT_ATTRIB_NAME, policy.getFormat());
    }

    if (policy.getSPNameQualifier() != null) {
        domElement.setAttributeNS(null, NameIDPolicy.SP_NAME_QUALIFIER_ATTRIB_NAME, policy.getSPNameQualifier());
    }

    if (policy.getAllowCreateXSBoolean() != null) {
        domElement.setAttributeNS(null, NameIDPolicy.ALLOW_CREATE_ATTRIB_NAME, policy.getAllowCreateXSBoolean()
                .toString());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:NameIDPolicyMarshaller.java


示例4: processAttribute

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    NameIDPolicy policy = (NameIDPolicy) samlObject;

    if (attribute.getLocalName().equals(NameIDPolicy.FORMAT_ATTRIB_NAME)) {
        policy.setFormat(attribute.getValue());
    }
    if (attribute.getLocalName().equals(NameIDPolicy.SP_NAME_QUALIFIER_ATTRIB_NAME)) {
        policy.setSPNameQualifier(attribute.getValue());
    }
    if (attribute.getLocalName().equals(NameIDPolicy.ALLOW_CREATE_ATTRIB_NAME)) {
        policy.setAllowCreate(XSBooleanValue.valueOf(attribute.getValue()));
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:NameIDPolicyUnmarshaller.java


示例5: createAuthnRequest

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private AuthnRequest createAuthnRequest(String surl, 
                boolean fauth, boolean isp, String proto,
                      NameIDPolicy npolicy, RequestedAuthnContext actx) {

  AuthnRequest ar = ((SAMLObjectBuilder<AuthnRequest>) 
  _bf.getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME)).buildObject();
  ar.setAssertionConsumerServiceURL(surl);
  ar.setForceAuthn(fauth);
  String uid = UUID.randomUUID().toString();
  
  ar.setID(uid);
  ar.setIsPassive(isp);
  ar.setIssueInstant(new DateTime());
  ar.setProtocolBinding(proto);
  ar.setVersion(SAMLVersion.VERSION_20);
  ar.setIssuer(getIssuer());
  // ar.setNameIDPolicy(npolicy);
  // ar.setRequestedAuthnContext(actx);
  
  return ar;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:23,代码来源:SamlSecurityProvider.java


示例6: testChildElementsMarshall

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, AuthnRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    AuthnRequest req = (AuthnRequest) buildXMLObject(qname);
    
    super.populateChildElements(req);
    
    QName subjectQName = new QName(SAMLConstants.SAML20_NS, Subject.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    req.setSubject((Subject) buildXMLObject(subjectQName));
    
    QName nameIDPolicyQName = new QName(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    req.setNameIDPolicy((NameIDPolicy) buildXMLObject(nameIDPolicyQName));
    
    QName conditionsQName = new QName(SAMLConstants.SAML20_NS, Conditions.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    req.setConditions((Conditions) buildXMLObject(conditionsQName));
    
    QName requestedAuthnContextQName = new QName(SAMLConstants.SAML20P_NS, RequestedAuthnContext.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    req.setRequestedAuthnContext((RequestedAuthnContext) buildXMLObject(requestedAuthnContextQName));
    
    QName scopingQName = new QName(SAMLConstants.SAML20P_NS, Scoping.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    req.setScoping((Scoping) buildXMLObject(scopingQName));
    
    assertEquals(expectedChildElementsDOM, req);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:25,代码来源:AuthnRequestTest.java


示例7: testXSBooleanAttributes

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/**
 * Test the proper behavior of the XSBooleanValue attributes.
 */
public void testXSBooleanAttributes() {
    NameIDPolicy policy = (NameIDPolicy) buildXMLObject(NameIDPolicy.DEFAULT_ELEMENT_NAME);
    
    // AllowCreate attribute
    policy.setAllowCreate(Boolean.TRUE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, policy.getAllowCreate());
    assertNotNull("XSBooleanValue was null", policy.getAllowCreateXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
            policy.getAllowCreateXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "true", policy.getAllowCreateXSBoolean().toString());
    
    policy.setAllowCreate(Boolean.FALSE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, policy.getAllowCreate());
    assertNotNull("XSBooleanValue was null", policy.getAllowCreateXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
            policy.getAllowCreateXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "false", policy.getAllowCreateXSBoolean().toString());
    
    policy.setAllowCreate((Boolean) null);
    assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, policy.getAllowCreate());
    assertNull("XSBooleanValue was not null", policy.getAllowCreateXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:26,代码来源:NameIDPolicyTest.java


示例8: setNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
public void setNameIDPolicy(String format, boolean allowCreate) {
	if (format == null || format.trim().equals("")) return;

	NameIDFormat idFormat = NameIDFormat.valueOf(format.toUpperCase());
	NameIDPolicy policy = SAMLUtil.buildXMLObject(NameIDPolicy.class);
	policy.setAllowCreate(allowCreate);
	policy.setFormat(idFormat.getFormat());
	policy.setSPNameQualifier(request.getIssuer().getValue());
	
	request.setNameIDPolicy(policy);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:12,代码来源:OIOAuthnRequest.java


示例9: buildNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/**
 * Build the NameIDPolicy object
 *
 * @return NameIDPolicy object
 */
private static NameIDPolicy buildNameIDPolicy(String nameIdPolicyFormat) {
    NameIDPolicy nameIDPolicy = new NameIDPolicyBuilder().buildObject();
    if (nameIdPolicyFormat == null) {
        nameIdPolicyFormat = SAML2SSOAuthenticatorConstants.SAML2_NAME_ID_POLICY_UNSPECIFIED;
    }
    nameIDPolicy.setFormat(nameIdPolicyFormat);
    nameIDPolicy.setAllowCreate(true);
    return nameIDPolicy;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:15,代码来源:AuthenticationRequestBuilder.java


示例10: populateRequiredData

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    
    NameIDMappingRequest request = (NameIDMappingRequest) target;
    NameID nameid = (NameID) buildXMLObject(new QName(SAMLConstants.SAML20_NS, NameID.DEFAULT_ELEMENT_LOCAL_NAME));
    NameIDPolicy policy = (NameIDPolicy) buildXMLObject(new QName(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME));
    
    request.setNameID(nameid);
    request.setNameIDPolicy(policy);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:NameIDMappingRequestSchemaTest.java


示例11: testSingleElementMarshall

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME);
    NameIDPolicy policy = (NameIDPolicy) buildXMLObject(qname);
    
    assertEquals(expectedDOM, policy);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:NameIDPolicyTest.java


示例12: testSingleElementOptionalAttributesMarshall

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME);
    NameIDPolicy policy = (NameIDPolicy) buildXMLObject(qname);
    
    policy.setFormat(expectedFormat);
    policy.setSPNameQualifier(expectedSPNameQualifer);
    policy.setAllowCreate(expectedAllowCreate);
    
    assertEquals(expectedOptionalAttributesDOM, policy);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:NameIDPolicyTest.java


示例13: testSingleElementOptionalAttributesUnmarshall

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesUnmarshall() {
    NameIDPolicy policy = (NameIDPolicy) unmarshallElement(singleElementOptionalAttributesFile);
    
    assertEquals("Unmarshalled name Format URI attribute value was not the expected value", expectedFormat, policy.getFormat());
    assertEquals("Unmarshalled SPNameQualifier URI attribute value was not the expected value", expectedSPNameQualifer, policy.getSPNameQualifier());
    assertEquals("Unmarshalled AllowCreate attribute value was not the expected value", expectedAllowCreate, policy.getAllowCreateXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:NameIDPolicyTest.java


示例14: testChildElementsMarshall

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, NameIDMappingRequest.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    NameIDMappingRequest req = (NameIDMappingRequest) buildXMLObject(qname);
    
    super.populateChildElements(req);
    
    QName nameIDQName = new QName(SAMLConstants.SAML20_NS, NameID.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    req.setNameID((NameID) buildXMLObject(nameIDQName));
    
    QName nameIDPolicyQName = new QName(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    req.setNameIDPolicy((NameIDPolicy) buildXMLObject(nameIDPolicyQName));
    
    assertEquals(expectedChildElementsDOM, req);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:16,代码来源:NameIDMappingRequestTest.java


示例15: buildNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/**
 * Build the NameIDPolicy object
 *
 * @return NameIDPolicy object
 */
private static NameIDPolicy buildNameIDPolicy() {
    NameIDPolicy nameIDPolicy = new NameIDPolicyBuilder().buildObject();
    nameIDPolicy.setFormat(SSOConstants.SAML2_NAME_ID_POLICY);
    nameIDPolicy.setAllowCreate(true);
    return nameIDPolicy;
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:12,代码来源:AuthReqBuilder.java


示例16: getNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public NameIDPolicy getNameIDPolicy() {
    return this.nameIDPolicy;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AuthnRequestImpl.java


示例17: setNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public void setNameIDPolicy(NameIDPolicy newNameIDPolicy) {
    this.nameIDPolicy = prepareForAssignment(this.nameIDPolicy, newNameIDPolicy);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AuthnRequestImpl.java


示例18: buildObject

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/** {@inheritDoc} */
public NameIDPolicy buildObject() {
    return buildObject(SAMLConstants.SAML20P_NS, NameIDPolicy.DEFAULT_ELEMENT_LOCAL_NAME,
            SAMLConstants.SAML20P_PREFIX);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:NameIDPolicyBuilder.java


示例19: buildNameIDPolicy

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
/**
 * Costruisce il NameIDPolicy object
 *
 * @return NameIDPolicy object
 */
private NameIDPolicy buildNameIDPolicy() {
	NameIDPolicy nameIDPolicy = new NameIDPolicyBuilder().buildObject();
	nameIDPolicy.setFormat(SAML2_NAME_ID_POLICY);
	return nameIDPolicy;
}
 
开发者ID:italia,项目名称:spid-spring,代码行数:11,代码来源:AuthenticationInfoExtractor.java


示例20: buildAuthnRequest

import org.opensaml.saml2.core.NameIDPolicy; //导入依赖的package包/类
protected AuthnRequest buildAuthnRequest(HttpServletRequest request) throws SSOAgentException {

        IssuerBuilder issuerBuilder = new IssuerBuilder();
        Issuer issuer =
                issuerBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:assertion",
                        "Issuer", "samlp");
        issuer.setValue(ssoAgentConfig.getSAML2().getSPEntityId());

		/* NameIDPolicy */
        NameIDPolicyBuilder nameIdPolicyBuilder = new NameIDPolicyBuilder();
        NameIDPolicy nameIdPolicy = nameIdPolicyBuilder.buildObject();
        nameIdPolicy.setFormat("urn:oasis:names:tc:SAML:2.0:nameid-format:persistent");
        nameIdPolicy.setSPNameQualifier("Issuer");
        nameIdPolicy.setAllowCreate(true);

		/* AuthnContextClass */
        AuthnContextClassRefBuilder authnContextClassRefBuilder = new AuthnContextClassRefBuilder();
        AuthnContextClassRef authnContextClassRef =
                authnContextClassRefBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:assertion",
                        "AuthnContextClassRef",
                        "saml");
        authnContextClassRef.setAuthnContextClassRef("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");

		/* AuthnContex */
        RequestedAuthnContextBuilder requestedAuthnContextBuilder =
                new RequestedAuthnContextBuilder();
        RequestedAuthnContext requestedAuthnContext = requestedAuthnContextBuilder.buildObject();
        requestedAuthnContext.setComparison(AuthnContextComparisonTypeEnumeration.EXACT);
        requestedAuthnContext.getAuthnContextClassRefs().add(authnContextClassRef);

        DateTime issueInstant = new DateTime();

		/* Creation of AuthRequestObject */
        AuthnRequestBuilder authRequestBuilder = new AuthnRequestBuilder();
        AuthnRequest authRequest =
                authRequestBuilder.buildObject("urn:oasis:names:tc:SAML:2.0:protocol",
                        "AuthnRequest", "samlp");

        authRequest.setForceAuthn(ssoAgentConfig.getSAML2().isForceAuthn());
        authRequest.setIsPassive(ssoAgentConfig.getSAML2().isPassiveAuthn());
        authRequest.setIssueInstant(issueInstant);
        authRequest.setProtocolBinding(ssoAgentConfig.getSAML2().getHttpBinding());
        authRequest.setAssertionConsumerServiceURL(ssoAgentConfig.getSAML2().getACSURL());
        authRequest.setIssuer(issuer);
        authRequest.setNameIDPolicy(nameIdPolicy);
        authRequest.setRequestedAuthnContext(requestedAuthnContext);
        authRequest.setID(SSOAgentUtils.createID());
        authRequest.setVersion(SAMLVersion.VERSION_20);
        authRequest.setDestination(ssoAgentConfig.getSAML2().getIdPURL());
        if (request.getAttribute(Extensions.LOCAL_NAME) != null) {
            authRequest.setExtensions((Extensions) request.getAttribute(Extensions.LOCAL_NAME));
        }

		/* Requesting Attributes. This Index value is registered in the IDP */
        if (ssoAgentConfig.getSAML2().getAttributeConsumingServiceIndex() != null &&
                ssoAgentConfig.getSAML2().getAttributeConsumingServiceIndex().trim().length() > 0) {
            authRequest.setAttributeConsumingServiceIndex(Integer.parseInt(
                    ssoAgentConfig.getSAML2().getAttributeConsumingServiceIndex()));
        }

        return authRequest;
    }
 
开发者ID:wso2-extensions,项目名称:identity-agent-sso,代码行数:63,代码来源:SAML2SSOManager.java



注:本文中的org.opensaml.saml2.core.NameIDPolicy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OFInstructionMeter类代码示例发布时间:2022-05-22
下一篇:
Java MethodEntryEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap