当前位置: 首页>>代码示例>>Java>>正文


Java NameIDPolicy类代码示例

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


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


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