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


Java AuthnContextClassRef类代码示例

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


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


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