Tabnine Logo
KeyDescriptor.getUse
Code IndexAdd Tabnine to your IDE (free)

How to use
getUse
method
in
org.opensaml.saml2.metadata.KeyDescriptor

Best Java code snippets using org.opensaml.saml2.metadata.KeyDescriptor.getUse (Showing top 11 results out of 315)

origin: apache/cloudstack

if (idpDescriptor.getKeyDescriptors() != null) {
  for (KeyDescriptor kd : idpDescriptor.getKeyDescriptors()) {
    if (kd.getUse() == UsageType.SIGNING) {
      try {
        idpMetadata.setSigningCertificate(KeyInfoHelper.getCertificates(kd.getKeyInfo()).get(0));
    if (kd.getUse() == UsageType.ENCRYPTION) {
      try {
        idpMetadata.setEncryptionCertificate(KeyInfoHelper.getCertificates(kd.getKeyInfo()).get(0));
    if (kd.getUse() == UsageType.UNSPECIFIED) {
      try {
        unspecifiedKey = KeyInfoHelper.getCertificates(kd.getKeyInfo()).get(0);
origin: coveo/saml-client

private static List<X509Certificate> getCertificates(IDPSSODescriptor idpSsoDescriptor)
  throws SamlException {
 List<X509Certificate> certificates;
 try {
  certificates =
    idpSsoDescriptor
      .getKeyDescriptors()
      .stream()
      .filter(x -> x.getUse() == UsageType.SIGNING)
      .flatMap(SamlClient::getDatasWithCertificates)
      .map(SamlClient::getFirstCertificate)
      .collect(Collectors.toList());
 } catch (Exception e) {
  throw new SamlException("Exception in getCertificates", e);
 }
 return certificates;
}
origin: org.opensaml/opensaml

  /** {@inheritDoc} */
  protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyDescriptor keyDescriptor = (KeyDescriptor) xmlObject;

    if (keyDescriptor.getUse() != null) {
      UsageType use = keyDescriptor.getUse();
      // UsageType enum contains more values than are allowed by SAML 2 schema
      if (use.equals(UsageType.SIGNING) || use.equals(UsageType.ENCRYPTION)) {
        domElement.setAttribute(KeyDescriptor.USE_ATTRIB_NAME, use.toString().toLowerCase());
      } else if (use.equals(UsageType.UNSPECIFIED)) {
        // emit nothing for unspecified - this is semantically equivalent to non-existent attribute
      } else {
        // Just in case values are unknowingly added to UsageType in the future...
        throw new MarshallingException("KeyDescriptor had illegal value for use attribute: " + use.toString());
      }
    }
  }
}
origin: org.wso2.carbon.identity.metadata.saml2/org.wso2.carbon.identity.sp.metadata.saml2

private void setX509Certificate(EntityDescriptor entityDescriptor, SPSSODescriptor spssoDescriptor, SAMLSSOServiceProviderDO samlssoServiceProviderDO) {
  List<KeyDescriptor> descriptors = spssoDescriptor.getKeyDescriptors();
  if (descriptors != null && descriptors.size() > 0) {
    KeyDescriptor descriptor = descriptors.get(0);
    if (descriptor != null) {
      if (descriptor.getUse().toString().equals("SIGNING")) {
        try {
          samlssoServiceProviderDO.setX509Certificate(org.opensaml.xml.security.keyinfo.KeyInfoHelper.getCertificates(descriptor.getKeyInfo()).get(0));
          samlssoServiceProviderDO.setCertAlias(entityDescriptor.getEntityID());
        } catch (java.security.cert.CertificateException ex) {
          log.error("Error While setting Certificate and alias", ex);
        } catch (java.lang.Exception ex) {
          log.error("Error While setting Certificate and alias", ex);
        }
      }
    }
  }
}
origin: org.wso2.carbon.identity.metadata.saml2/org.wso2.carbon.identity.inbound.metadata.saml2

private void  setX509Certificate(EntityDescriptor entityDescriptor,SPSSODescriptor spssoDescriptor, SAMLSSOServiceProviderDO samlssoServiceProviderDO){
  List<KeyDescriptor> descriptors = spssoDescriptor.getKeyDescriptors();
  if (descriptors != null && descriptors.size() > 0) {
    KeyDescriptor descriptor = descriptors.get(0);
    if (descriptor != null) {
      if (descriptor.getUse().toString().equals("SIGNING")) {
        try {
          samlssoServiceProviderDO.setX509Certificate(org.opensaml.xml.security.keyinfo.KeyInfoHelper.getCertificates(descriptor.getKeyInfo()).get(0));
          samlssoServiceProviderDO.setCertAlias(entityDescriptor.getEntityID());
        } catch (java.security.cert.CertificateException ex) {
          log.error("Error While setting Certificate and alias", ex);
        }catch(java.lang.Exception ex){
          log.error("Error While setting Certificate and alias", ex);
        }
      }
    }
  }
}
private void  setSigningAlgorithmUri(SPSSODescriptor spssoDescriptor, SAMLSSOServiceProviderDO samlssoServiceProviderDO){
origin: edu.internet2.middleware/shibboleth-common

UsageType mdUsage = keyDescriptor.getUse();
if (mdUsage == null) {
  mdUsage = UsageType.UNSPECIFIED;
origin: org.opensaml/opensaml

  /**
   * Checks that use attribute has only one of allowed values.
   * 
   * @param keyDescriptor the key descriptor to validate
   * @throws ValidationException throw in use attribute does not have a legal value
   */
  protected void validateUse(KeyDescriptor keyDescriptor) throws ValidationException {
    UsageType use = keyDescriptor.getUse();
    if (use == null) {
      return;
    }
    if (       ! use.equals(UsageType.SIGNING) 
        && ! use.equals(UsageType.ENCRYPTION) 
        && ! use.equals(UsageType.UNSPECIFIED) ) {
      throw new ValidationException("Invalid value for use attribute: " + use.toString());
    }
  }
}
origin: org.opensaml/opensaml

UsageType mdUsage = keyDescriptor.getUse();
if (mdUsage == null) {
  mdUsage = UsageType.UNSPECIFIED;
origin: org.adeptnet.auth/auth-saml

if (kdesc.getUse() != UsageType.SIGNING) {
  continue;
origin: org.wso2.carbon.identity.metadata.saml2/org.wso2.carbon.identity.outbound.metadata.saml2

  String use = "";
  try {
    use = descriptor.getUse().name().toString();
  } catch (Exception ex) {
    log.error("Error !!!!", ex);
KeyDescriptor descriptor = descriptors.get(i);
if (descriptor != null) {
  if (descriptor.getUse() != null && "SIGNING".equals(descriptor.getUse().toString())) {
    try {
      String cert = null;
origin: lastpass/saml-sdk-java

if (kdesc.getUse() != UsageType.SIGNING)
  continue;
org.opensaml.saml2.metadataKeyDescriptorgetUse

Javadoc

Gets the use of this key.

Popular methods of KeyDescriptor

  • getKeyInfo
    Gets information about the key, including the key itself.
  • setKeyInfo
    Sets information about the key, including the key itself.
  • setUse
    Sets the use of this key.
  • getEncryptionMethods
    Gets the encryption methods that are supported by the entity.
  • getParent

Popular in Java

  • Running tasks concurrently on multiple threads
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Notification (javax.management)
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now