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

Java AuthnContextClassRef类代码示例

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

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



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

示例1: getAuthnContextClassRef

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/**
 * Return the value of the /AuthnStatement/AuthnContext/AuthnContextClassRef
 * element in an assertion
 * 
 * @return The value. <code>null</code>, if the assertion does not
 *         contain the element.
 */
public String getAuthnContextClassRef() {
	String retVal = null;
   	if (assertion.getAuthnStatements() != null) {
   		if (assertion.getAuthnStatements().size() > 0) {
   			// We only look into the first AuthnStatement
   			AuthnStatement authnStatement = (AuthnStatement) assertion.getAuthnStatements().get(0);
   			AuthnContext authnContext = authnStatement.getAuthnContext();
   			if (authnContext != null) {
   				AuthnContextClassRef authnContextClassRef = authnContext.getAuthnContextClassRef();
   				if (authnContextClassRef != null) {
   					retVal = authnContextClassRef.getAuthnContextClassRef();
   				}
   			}
   		}
   	}
   	return retVal;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:25,代码来源:OIOAssertion.java


示例2: getAuthnContextClassRef

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
@Test
public void getAuthnContextClassRef() {

	String expectedAuthnContextClassRefString = "expected string";
	AuthnContextClassRef authnContextClassRef = new AuthnContextClassRefStubImpl();
	authnContextClassRef.setAuthnContextClassRef(expectedAuthnContextClassRefString);

	AuthnContext authnContext = new AuthnContextStubImpl();
	authnContext.setAuthnContextClassRef(authnContextClassRef);

	AuthnStatement authnStatement= new AuthnStatementStubImpl();
	authnStatement.setAuthnContext(authnContext);

	List<AuthnStatement> authnStatements = new ArrayList<AuthnStatement>();
	authnStatements.add(authnStatement);

	Assertion assertion = new AssertionStubImpl(authnStatements);

	assertEquals(expectedAuthnContextClassRefString, new OIOAssertion(assertion).getAuthnContextClassRef());
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:21,代码来源:OIOAssertionTest.java


示例3: testChildElementsMarshall

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20_NS, AuthnContext.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    AuthnContext authnContext = (AuthnContext) buildXMLObject(qname);

    QName authnContextClassRefQName = new QName(SAMLConstants.SAML20_NS, AuthnContextClassRef.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    authnContext.setAuthnContextClassRef((AuthnContextClassRef) buildXMLObject(authnContextClassRefQName));
    
    QName authnContextDeclQName = new QName(SAMLConstants.SAML20_NS, AuthnContextDecl.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    authnContext.setAuthnContextDecl((AuthnContextDecl) buildXMLObject(authnContextDeclQName));
    
    QName authnContextDeclRefQName = new QName(SAMLConstants.SAML20_NS, AuthnContextDeclRef.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    authnContext.setAuthnContextDeclRef((AuthnContextDeclRef) buildXMLObject(authnContextDeclRefQName));
    
    QName authenticatingAuthorityQName = new QName(SAMLConstants.SAML20_NS, AuthenticatingAuthority.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    for (int i = 0; i < expectedAuthenticatingAuthorityCount; i++) {
        authnContext.getAuthenticatingAuthorities().add((AuthenticatingAuthority) buildXMLObject(authenticatingAuthorityQName));
    }

    assertEquals(expectedChildElementsDOM, authnContext);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:22,代码来源:AuthnContextTest.java


示例4: getSAMLBuilder

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
private static XMLObjectBuilderFactory getSAMLBuilder() throws ConfigurationException {

	if (builderFactory == null) {
	    // OpenSAML 2.3
	    DefaultBootstrap.bootstrap();
	    builderFactory = Configuration.getBuilderFactory();
	    nameIdBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(NameID.DEFAULT_ELEMENT_NAME);
	    confirmationMethodBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmationData.DEFAULT_ELEMENT_NAME);
	    subjectConfirmationBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(SubjectConfirmation.DEFAULT_ELEMENT_NAME);
	    subjectBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Subject.DEFAULT_ELEMENT_NAME);
	    attrStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AttributeStatement.DEFAULT_ELEMENT_NAME);
	    audienceRestrictionnBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AudienceRestriction.DEFAULT_ELEMENT_NAME);
	    audienceBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Audience.DEFAULT_ELEMENT_NAME);
	    authStatementBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnStatement.DEFAULT_ELEMENT_NAME);
	    authContextBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContext.DEFAULT_ELEMENT_NAME);
	    authContextClassRefBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(AuthnContextClassRef.DEFAULT_ELEMENT_NAME);
	    issuerBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
	    assertionBuilder = (SAMLObjectBuilder) getSAMLBuilder().getBuilder(Assertion.DEFAULT_ELEMENT_NAME);

	}

	return builderFactory;
    }
 
开发者ID:mwdb,项目名称:OA2C,代码行数:24,代码来源:LocalSamlTokenFactory.java


示例5: createAuthnStatement

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
private AuthnStatement createAuthnStatement(final DateTime issueDate) {
	// create authcontextclassref object
	AuthnContextClassRefBuilder classRefBuilder = new AuthnContextClassRefBuilder();
	AuthnContextClassRef classRef = classRefBuilder.buildObject();
	classRef.setAuthnContextClassRef("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
	
	// create authcontext object
	AuthnContextBuilder authContextBuilder = new AuthnContextBuilder();
	AuthnContext authnContext = authContextBuilder.buildObject();
	authnContext.setAuthnContextClassRef(classRef);
	
	// create authenticationstatement object
	AuthnStatementBuilder authStatementBuilder = new AuthnStatementBuilder();
	AuthnStatement authnStatement = authStatementBuilder.buildObject();
	authnStatement.setAuthnInstant(issueDate);
	authnStatement.setAuthnContext(authnContext);
	
	return authnStatement;
}
 
开发者ID:rackerlabs,项目名称:saml-generator,代码行数:20,代码来源:SamlAssertionProducer.java


示例6: processChildElement

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    AuthnContext authnContext = (AuthnContext) parentObject;
    if (childObject instanceof AuthnContextClassRef) {
        authnContext.setAuthnContextClassRef((AuthnContextClassRef) childObject);
    } else if (childObject instanceof AuthnContextDecl) {
        authnContext.setAuthnContextDecl((AuthnContextDecl) childObject);
    } else if (childObject instanceof AuthnContextDeclRef) {
        authnContext.setAuthnContextDeclRef((AuthnContextDeclRef) childObject);
    } else if (childObject instanceof AuthenticatingAuthority) {
        authnContext.getAuthenticatingAuthorities().add((AuthenticatingAuthority) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:AuthnContextUnmarshaller.java


示例7: processChildElement

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    RequestedAuthnContext rac = (RequestedAuthnContext) parentSAMLObject;
    if (childSAMLObject instanceof AuthnContextClassRef) {
        rac.getAuthnContextClassRefs().add((AuthnContextClassRef) childSAMLObject);
    } else if (childSAMLObject instanceof AuthnContextDeclRef) {
        rac.getAuthnContextDeclRefs().add((AuthnContextDeclRef) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:RequestedAuthnContextUnmarshaller.java


示例8: buildRequestedAuthnContext

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
private RequestedAuthnContext buildRequestedAuthnContext() {

		// Create AuthnContextClassRef
		AuthnContextClassRefBuilder authnContextClassRefBuilder = new AuthnContextClassRefBuilder();
		AuthnContextClassRef authnContextClassRef = authnContextClassRefBuilder.buildObject(SAML2_ASSERTION, "AuthnContextClassRef", "saml");
		authnContextClassRef.setAuthnContextClassRef(SAML2_PASSWORD_PROTECTED_TRANSPORT);

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

		return requestedAuthnContext;
	}
 
开发者ID:italia,项目名称:spid-spring,代码行数:16,代码来源:AuthenticationInfoExtractor.java


示例9: createAuthnContext

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/**
 * Create an authnContext with a given authnContextClassRef.
 * 
 * @param authnContextClassRefValue
 *            The value of the authnContextClassRef
 * @return The SAML authnContext with the given authnContextClassRef
 */
public static AuthnContext createAuthnContext(
		String authnContextClassRefValue) {
	AuthnContext authnContext = buildXMLObject(AuthnContext.class);
	AuthnContextClassRef authnContextClassRef = buildXMLObject(AuthnContextClassRef.class);
	authnContextClassRef.setAuthnContextClassRef(authnContextClassRefValue);
	authnContext.setAuthnContextClassRef(authnContextClassRef);
	return authnContext;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:16,代码来源:SAMLUtil.java


示例10: testCreateAuthnContext

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
@Test
public void testCreateAuthnContext() {
	AuthnContext ac = SAMLUtil.createAuthnContext("ref");
	assertNotNull(ac);
	assertNull(ac.getAuthContextDecl());
	assertTrue(ac.getAuthenticatingAuthorities().isEmpty());
	assertNull(ac.getAuthnContextDeclRef());
	
	AuthnContextClassRef cr = ac.getAuthnContextClassRef();
	assertNotNull(cr);
	assertEquals("ref", cr.getAuthnContextClassRef());
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:13,代码来源:SAMLUtilTest.java


示例11: testURIFailure

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/**
 * Tests absent Class Reference failure.
 * 
 * @throws ValidationException
 */
public void testURIFailure() throws ValidationException {
    AuthnContextClassRef authnContextClassRef = (AuthnContextClassRef) target;

    authnContextClassRef.setAuthnContextClassRef(null);
    assertValidationFail("ClassRef was null, should raise a Validation Exception");

    authnContextClassRef.setAuthnContextClassRef("");
    assertValidationFail("ClassRef was empty string, should raise a Validation Exception");
    
    authnContextClassRef.setAuthnContextClassRef("    ");
    assertValidationFail("ClassRef was white space, should raise a Validation Exception");
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:AuthnContextClassRefSchemaTest.java


示例12: RequestedAuthnContextSchemaTest

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/**
 * Constructor
 *
 */
public RequestedAuthnContextSchemaTest() {
    super();
    targetQName = new QName(SAMLConstants.SAML20P_NS, RequestedAuthnContext.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX);
    validator = new RequestedAuthnContextSchemaValidator();
    
    authnContextClassRef = (AuthnContextClassRef) buildXMLObject(new QName(SAMLConstants.SAML20_NS, AuthnContextClassRef.DEFAULT_ELEMENT_LOCAL_NAME));
    authnContextDeclRef = (AuthnContextDeclRef) buildXMLObject(new QName(SAMLConstants.SAML20_NS, AuthnContextDeclRef.DEFAULT_ELEMENT_LOCAL_NAME));
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:13,代码来源:RequestedAuthnContextSchemaTest.java


示例13: testChildElementsMarshall

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
    QName qname = new QName(SAMLConstants.SAML20P_NS, RequestedAuthnContext.DEFAULT_ELEMENT_LOCAL_NAME);
    RequestedAuthnContext rac = (RequestedAuthnContext) buildXMLObject(qname);
    
    QName authnContextClassRefQName = new QName(SAMLConstants.SAML20_NS, AuthnContextClassRef.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    for (int i=0; i< expectedNumClassRefs; i++){
        rac.getAuthnContextClassRefs().add((AuthnContextClassRef) buildXMLObject(authnContextClassRefQName));
    }
    
    assertEquals(expectedChildElementsDOM, rac);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:13,代码来源:RequestedAuthnContextTest.java


示例14: testSingleElementUnmarshall

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
    AuthnContextClassRef authnContextClassRef = (AuthnContextClassRef) unmarshallElement(singleElementFile);

    String classRef = authnContextClassRef.getAuthnContextClassRef();
    assertEquals("Class Reference was " + classRef + ", expected " + expectedClassRef, expectedClassRef, classRef);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:AuthnContextClassRefTest.java


示例15: testSingleElementMarshall

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20_NS, AuthnContextClassRef.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX);
    AuthnContextClassRef authnContextClassRef = (AuthnContextClassRef) buildXMLObject(qname);

    authnContextClassRef.setAuthnContextClassRef(expectedClassRef);
    assertEquals(expectedDOM, authnContextClassRef);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:AuthnContextClassRefTest.java


示例16: buildAuthnRequestObject

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
public static AuthnRequest buildAuthnRequestObject(final String authnId, final String spId, final String idpUrl, final String consumerUrl) {
    // Issuer object
    IssuerBuilder issuerBuilder = new IssuerBuilder();
    Issuer issuer = issuerBuilder.buildObject();
    issuer.setValue(spId);

    // AuthnContextClass
    AuthnContextClassRefBuilder authnContextClassRefBuilder = new AuthnContextClassRefBuilder();
    AuthnContextClassRef authnContextClassRef = authnContextClassRefBuilder.buildObject(
            SAMLConstants.SAML20_NS,
            "AuthnContextClassRef", "saml");
    authnContextClassRef.setAuthnContextClassRef(AuthnContext.PPT_AUTHN_CTX);

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

    // Creation of AuthRequestObject
    AuthnRequestBuilder authRequestBuilder = new AuthnRequestBuilder();
    AuthnRequest authnRequest = authRequestBuilder.buildObject();
    authnRequest.setID(authnId);
    authnRequest.setDestination(idpUrl);
    authnRequest.setVersion(SAMLVersion.VERSION_20);
    authnRequest.setForceAuthn(false);
    authnRequest.setIsPassive(false);
    authnRequest.setIssueInstant(new DateTime());
    authnRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);
    authnRequest.setAssertionConsumerServiceURL(consumerUrl);
    authnRequest.setProviderName(spId);
    authnRequest.setIssuer(issuer);
    authnRequest.setRequestedAuthnContext(requestedAuthnContext);

    return authnRequest;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:37,代码来源:SAMLUtils.java


示例17: buildAuthnStatement

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
private AuthnStatement buildAuthnStatement() throws IllegalAccessException {
	AuthnStatement authnStatement = buildXMLObjectDefaultName(AuthnStatement.class);
	AuthnContext authnContext = buildXMLObjectDefaultName(AuthnContext.class);
	AuthnContextClassRef authnContextClassRef = buildXMLObjectDefaultName(AuthnContextClassRef.class);
	authnContextClassRef.setAuthnContextClassRef("urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport");
	authnContext.setAuthnContextClassRef(authnContextClassRef);
	authnStatement.setAuthnContext(authnContext);

	authnStatement.setAuthnInstant(new DateTime());

	return authnStatement;
}
 
开发者ID:rasmusson,项目名称:MockIDP,代码行数:13,代码来源:MockIDPArtifactResolve.java


示例18: validate

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(AuthnContextClassRef authnContextClassRef) throws ValidationException {
    validateClassRef(authnContextClassRef);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:AuthnContextClassRefSchemaValidator.java


示例19: processElementContent

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processElementContent(XMLObject samlObject, String elementContent) {
    AuthnContextClassRef authnContextClassRef = (AuthnContextClassRef) samlObject;
    authnContextClassRef.setAuthnContextClassRef(elementContent);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:AuthnContextClassRefUnmarshaller.java


示例20: marshallElementContent

import org.opensaml.saml2.core.AuthnContextClassRef; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
    AuthnContextClassRef authnContextClassRef = (AuthnContextClassRef) samlObject;
    XMLHelper.appendTextContent(domElement, authnContextClassRef.getAuthnContextClassRef());
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:6,代码来源:AuthnContextClassRefMarshaller.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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