本文整理汇总了Java中org.opensaml.saml2.metadata.SingleSignOnService类的典型用法代码示例。如果您正苦于以下问题:Java SingleSignOnService类的具体用法?Java SingleSignOnService怎么用?Java SingleSignOnService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SingleSignOnService类属于org.opensaml.saml2.metadata包,在下文中一共展示了SingleSignOnService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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"));
}
示例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");
}
示例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));
}
示例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);
}
示例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);
}
示例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());
}
示例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());;
}
示例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);
}
示例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);
}
示例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;
}
};
}
示例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;
}