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

Java SingleSignOnService类代码示例

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

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



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

示例1: processChildElement

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentObject, XMLObject childObject) throws UnmarshallingException {
    IDPSSODescriptor descriptor = (IDPSSODescriptor) parentObject;

    if (childObject instanceof SingleSignOnService) {
        descriptor.getSingleSignOnServices().add((SingleSignOnService) childObject);
    } else if (childObject instanceof NameIDMappingService) {
        descriptor.getNameIDMappingServices().add((NameIDMappingService) childObject);
    } else if (childObject instanceof AssertionIDRequestService) {
        descriptor.getAssertionIDRequestServices().add((AssertionIDRequestService) childObject);
    } else if (childObject instanceof AttributeProfile) {
        descriptor.getAttributeProfiles().add((AttributeProfile) childObject);
    } else if (childObject instanceof Attribute) {
        descriptor.getAttributes().add((Attribute) childObject);
    } else {
        super.processChildElement(parentObject, childObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:IDPSSODescriptorUnmarshaller.java


示例2: IDPSSODescriptorImpl

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param namespaceURI the namespace the element is in
 * @param elementLocalName the local name of the XML element this Object represents
 * @param namespacePrefix the prefix for the given namespace
 */
protected IDPSSODescriptorImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
    super(namespaceURI, elementLocalName, namespacePrefix);
    singleSignOnServices = new XMLObjectChildrenList<SingleSignOnService>(this);
    nameIDMappingServices = new XMLObjectChildrenList<NameIDMappingService>(this);
    assertionIDRequestServices = new XMLObjectChildrenList<AssertionIDRequestService>(this);
    attributeProfiles = new XMLObjectChildrenList<AttributeProfile>(this);
    attributes = new XMLObjectChildrenList<Attribute>(this);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:IDPSSODescriptorImpl.java


示例3: getEndpoints

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public List<Endpoint> getEndpoints(QName type) {
    if(type.equals(SingleSignOnService.DEFAULT_ELEMENT_NAME)){
        return Collections.unmodifiableList(new ArrayList<Endpoint>(singleSignOnServices));
    }else if(type.equals(NameIDMappingService.DEFAULT_ELEMENT_NAME)){
        return Collections.unmodifiableList(new ArrayList<Endpoint>(nameIDMappingServices));
    }else if(type.equals(AssertionIDRequestService.DEFAULT_ELEMENT_NAME)){
        return Collections.unmodifiableList(new ArrayList<Endpoint>(assertionIDRequestServices));
    }else{
        return super.getEndpoints(type);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:IDPSSODescriptorImpl.java


示例4: getSingleSignOnService

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private SingleSignOnService getSingleSignOnService(final SAMLConfig configuration, final String binding) {
	SAMLObjectBuilder<SingleSignOnService> builder = (SAMLObjectBuilder<SingleSignOnService>) builderFactory.getBuilder(SingleSignOnService.DEFAULT_ELEMENT_NAME);
	SingleSignOnService service = builder.buildObject();
	service.setBinding(binding);
	service.setLocation(configuration.getLoginUrl());

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


示例5: getPostBinding

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
private static SingleSignOnService getPostBinding(IDPSSODescriptor idpSsoDescriptor)
    throws SamlException {
  return idpSsoDescriptor
      .getSingleSignOnServices()
      .stream()
      .filter(x -> x.getBinding().equals("urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"))
      .findAny()
      .orElseThrow(() -> new SamlException("Cannot find HTTP-POST SSO binding in metadata"));
}
 
开发者ID:coveo,项目名称:saml-client,代码行数:10,代码来源:SamlClient.java


示例6: getSingleSignonServiceLocation

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/**
 * Get a signon service location for a specific binding.
 * @param binding SAML binding name,
 * @return The url for the location.
 * @throws IllegalArgumentException if the binding is not present in metadata.
 */
public String getSingleSignonServiceLocation(String binding) throws IllegalArgumentException {
	for (SingleSignOnService service : idpSSODescriptor.getSingleSignOnServices()) {
		if (service.getBinding().equals(binding)) {
			return service.getLocation();
		}
	}
	throw new IllegalArgumentException("Binding " + binding + " not found");
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:15,代码来源:IdpMetadata.java


示例7: findLoginEndpoint

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/**
 * Find a supported login endpoint.
 * @throws IllegalArgumentException If no services match the selected bindings. 
 */
public Endpoint findLoginEndpoint(String[] bindings) {
	if (bindings == null) throw new IllegalArgumentException("bindings cannot be null");
	
	for (String binding : bindings) {
		for (SingleSignOnService service : idpSSODescriptor.getSingleSignOnServices()) {
			if (service.getBinding().equalsIgnoreCase(binding)) {
				return service;
			}
		}
	}
	throw new IllegalArgumentException("No SingleSignonService found for " + Arrays.toString(bindings));
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:17,代码来源:IdpMetadata.java


示例8: populateRequiredData

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    IDPSSODescriptor idpssoDescriptor = (IDPSSODescriptor) target;
    SingleSignOnService singleSignOnService = (SingleSignOnService) buildXMLObject(new QName(
            SAMLConstants.SAML20MD_NS, SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
    idpssoDescriptor.getSingleSignOnServices().add(singleSignOnService);
    NameIDMappingService nameIDMappingService = (NameIDMappingService) buildXMLObject(new QName(
            SAMLConstants.SAML20MD_NS, NameIDMappingService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
    idpssoDescriptor.getNameIDMappingServices().add(nameIDMappingService);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:IDPSSODescriptorSpecTest.java


示例9: populateRequiredData

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    IDPSSODescriptor idpssoDescriptor = (IDPSSODescriptor) target;
    SingleSignOnService singleSignOnService = (SingleSignOnService) buildXMLObject(new QName(SAMLConstants.SAML20MD_NS,
            SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
    idpssoDescriptor.getSingleSignOnServices().add(singleSignOnService);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:IDPSSODescriptorSchemaTest.java


示例10: testSingleElementUnmarshall

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
    SingleSignOnService service = ( SingleSignOnService) unmarshallElement(singleElementFile);
    
    assertEquals("Binding URI was not expected value", expectedBinding, service.getBinding());
    assertEquals("Location was not expected value", expectedLocation, service.getLocation());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:8,代码来源:SingleSignOnServiceTest.java


示例11: testSingleElementOptionalAttributesUnmarshall

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesUnmarshall() {
    SingleSignOnService service = ( SingleSignOnService) unmarshallElement(singleElementOptionalAttributesFile);
    
    assertEquals("Binding URI was not expected value", expectedBinding, service.getBinding());
    assertEquals("Location was not expected value", expectedLocation, service.getLocation());
    assertEquals("ResponseLocation was not expected value", expectedResponseLocation, service.getResponseLocation());;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:SingleSignOnServiceTest.java


示例12: testSingleElementMarshall

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementMarshall() {
    QName qname = new QName(SAMLConstants.SAML20MD_NS,  SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME);
    SingleSignOnService service = ( SingleSignOnService) buildXMLObject(qname);
    
    service.setBinding(expectedBinding);
    service.setLocation(expectedLocation);

    assertEquals(expectedDOM, service);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:SingleSignOnServiceTest.java


示例13: testSingleElementOptionalAttributesMarshall

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesMarshall() {
    QName qname = new QName(SAMLConstants.SAML20MD_NS,  SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME);
    SingleSignOnService service = ( SingleSignOnService) buildXMLObject(qname);
    
    service.setBinding(expectedBinding);
    service.setLocation(expectedLocation);
    service.setResponseLocation(expectedResponseLocation);

    assertEquals(expectedOptionalAttributesDOM, service);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:12,代码来源:SingleSignOnServiceTest.java


示例14: webSSOprofile

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
@Bean
public WebSSOProfile webSSOprofile() {
    return new WebSSOProfileImpl() {

        @Override
        protected AuthnRequest getAuthnRequest(SAMLMessageContext context, WebSSOProfileOptions options, AssertionConsumerService assertionConsumer, SingleSignOnService bindingService) throws SAMLException, MetadataProviderException {
            AuthnRequest authnRequest = super.getAuthnRequest(context, options, assertionConsumer, bindingService);
            authnRequest.setExtensions(buildExtensions());
            return authnRequest;
        }

        /**
         * Language extension to AuthnRequest:
         *
         *  <samlp:Extensions>
                <vetuma xmlns="urn:vetuma:SAML:2.0:extensions">
                    <LG>[fi|sv]</LG>
                </vetuma>
            </samlp:Extensions>
         */
        private Extensions buildExtensions() {
            Extensions extensions = new ExtensionsBuilder()
                    .buildObject("urn:oasis:names:tc:SAML:2.0:protocol", "Extensions", "saml2p");
            XSAny vetuma = new XSAnyBuilder().buildObject(new QName("urn:vetuma:SAML:2.0:extensions", "vetuma"));
            XSAny language = new XSAnyBuilder().buildObject(new QName("urn:vetuma:SAML:2.0:extensions", "LG"));

            String idpLanguageFromTarget = TargetStoringFilter.getRequestParamTarget(((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest())
                    .map(t -> t.startsWith(Urls.FRONT_SV) ? "sv" : "fi")
                    .orElse("fi");

            language.setTextContent(idpLanguageFromTarget);
            extensions.getUnknownXMLObjects().add(vetuma);
            vetuma.getUnknownXMLObjects().add(language);
            return extensions;
        }
    };
}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:38,代码来源:WebSecurityConfig.java


示例15: getIPDEndpoint

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
private Endpoint getIPDEndpoint() {
    SingleSignOnService endpoint = OpenSAMLUtils.buildSAMLObject(SingleSignOnService.class);
    endpoint.setBinding(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
    endpoint.setLocation(getIPDSSODestination());

    return endpoint;
}
 
开发者ID:rasmusson,项目名称:webprofile-ref-project,代码行数:8,代码来源:AccessFilter.java


示例16: getSingleSignOnServices

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public List<SingleSignOnService> getSingleSignOnServices() {
    return singleSignOnServices;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:IDPSSODescriptorImpl.java


示例17: buildObject

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/** {@inheritDoc} */
public SingleSignOnService buildObject() {
    return buildObject(SAMLConstants.SAML20MD_NS, SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:5,代码来源:SingleSignOnServiceBuilder.java


示例18: fromMetadata

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
/**
 * Constructs an SAML client using XML metadata obtained from the identity provider. <p> When
 * using Okta as an identity provider, it is possible to pass null to relyingPartyIdentifier and
 * assertionConsumerServiceUrl; they will be inferred from the metadata provider XML.
 *
 * @param relyingPartyIdentifier      the identifier for the relying party.
 * @param assertionConsumerServiceUrl the url where the identity provider will post back the
 *                                    SAML response.
 * @param metadata                    the XML metadata obtained from the identity provider.
 * @return The created {@link SamlClient}.
 * @throws SamlException thrown if any error occur while loading the metadata information.
 */
public static SamlClient fromMetadata(
    String relyingPartyIdentifier, String assertionConsumerServiceUrl, Reader metadata)
    throws SamlException {

  ensureOpenSamlIsInitialized();

  MetadataProvider metadataProvider = createMetadataProvider(metadata);
  EntityDescriptor entityDescriptor = getEntityDescriptor(metadataProvider);

  IDPSSODescriptor idpSsoDescriptor = getIDPSSODescriptor(entityDescriptor);
  SingleSignOnService postBinding = getPostBinding(idpSsoDescriptor);
  List<X509Certificate> x509Certificates = getCertificates(idpSsoDescriptor);
  boolean isOkta = entityDescriptor.getEntityID().contains(".okta.com");

  if (relyingPartyIdentifier == null) {
    // Okta's own toolkit uses the entity ID as a relying party identifier, so if we
    // detect that the IDP is Okta let's tolerate a null value for this parameter.
    if (isOkta) {
      relyingPartyIdentifier = entityDescriptor.getEntityID();
    } else {
      throw new IllegalArgumentException("relyingPartyIdentifier");
    }
  }

  if (assertionConsumerServiceUrl == null && isOkta) {
    // Again, Okta's own toolkit uses this value for the assertion consumer url, which
    // kinda makes no sense since this is supposed to be a url pointing to a server
    // outside Okta, but it probably just straight ignores this and use the one from
    // it's own config anyway.
    assertionConsumerServiceUrl = postBinding.getLocation();
  }

  String identityProviderUrl = postBinding.getLocation();
  String responseIssuer = entityDescriptor.getEntityID();

  return new SamlClient(
      relyingPartyIdentifier,
      assertionConsumerServiceUrl,
      identityProviderUrl,
      responseIssuer,
      x509Certificates);
}
 
开发者ID:coveo,项目名称:saml-client,代码行数:55,代码来源:SamlClient.java


示例19: generateIdPDescriptor

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
private EntityDescriptor generateIdPDescriptor(String stsEntityId, String stsLocation, String stsLogoutLocation, byte[] stsKeystore) {
	EntityDescriptor descriptor = SAMLUtil.buildXMLObject(EntityDescriptor.class);
	descriptor.setEntityID(stsEntityId);

	IDPSSODescriptor desc = SAMLUtil.buildXMLObject(IDPSSODescriptor.class);
	desc.addSupportedProtocol("http://schemas.xmlsoap.org/ws/2006/12/federation");
	
	KeyDescriptor signingDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	signingDescriptor.setUse(UsageType.SIGNING);
	KeyDescriptor encryptionDescriptor = SAMLUtil.buildXMLObject(KeyDescriptor.class);
	encryptionDescriptor.setUse(UsageType.ENCRYPTION);

	try {
		CertificateFactory cf = CertificateFactory.getInstance("X.509");
		X509Certificate cert = (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(stsKeystore));
		BasicX509Credential credential = new BasicX509Credential();
		credential.setEntityCertificate(cert);
		
		KeyInfoGenerator gen = SecurityHelper.getKeyInfoGenerator(credential, org.opensaml.xml.Configuration.getGlobalSecurityConfiguration(), null);
		signingDescriptor.setKeyInfo(gen.generate(credential));
		encryptionDescriptor.setKeyInfo(gen.generate(credential));
	} catch (SecurityException e1) {
		throw new WrappedException(Layer.BUSINESS, e1);
	} catch (CertificateException e) {
		throw new WrappedException(Layer.BUSINESS, e);
	}
	desc.getKeyDescriptors().add(signingDescriptor);
	desc.getKeyDescriptors().add(encryptionDescriptor);
	
	SingleSignOnService sso = SAMLUtil.buildXMLObject(SingleSignOnService.class);
	sso.setBinding("http://schemas.xmlsoap.org/ws/2006/12/federation");
	sso.setLocation(stsLocation);
	desc.getSingleSignOnServices().add(sso);

	//TODO: Check that the location should be the same
	SingleLogoutService slo = SAMLUtil.buildXMLObject(SingleLogoutService.class);
	slo.setBinding("http://schemas.xmlsoap.org/ws/2006/12/federation");
	slo.setLocation(stsLogoutLocation);
	desc.getSingleLogoutServices().add(slo);
	
	descriptor.getRoleDescriptors().add(desc);
	return descriptor;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:44,代码来源:ConfigurationHandler.java


示例20: getSingleSignonServices

import org.opensaml.saml2.metadata.SingleSignOnService; //导入依赖的package包/类
public List<SingleSignOnService> getSingleSignonServices() {
	return idpSSODescriptor.getSingleSignOnServices();
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:4,代码来源:IdpMetadata.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java Subscription类代码示例发布时间:2022-05-22
下一篇:
Java GcInfoCompositeData类代码示例发布时间: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