org.keycloak.saml.processing.core.util

## Class KeycloakKeySamlExtensionGenerator

- java.lang.Object
- - org.keycloak.saml.processing.core.util.KeycloakKeySamlExtensionGenerator

- All Implemented Interfaces:
    SamlProtocolExtensionsAwareBuilder.NodeGenerator

      public class KeycloakKeySamlExtensionGenerator
      extends Object
      implements SamlProtocolExtensionsAwareBuilder.NodeGenerator

  Author:
    hmlnarik

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `KC_KEY_INFO_ELEMENT_NAME`
    `static String` | `KEY_ID_ATTRIBUTE_NAME`
    `static String` | `NS_PREFIX`
    `static String` | `NS_URI`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeycloakKeySamlExtensionGenerator(String keyId)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getMessageSigningKeyIdFromElement(Element element)` Checks that the given element is indeed a Keycloak extension `KeyInfo` element and returns a content of `MessageSigningKeyId` attribute in the given element.
    `void` | `write(XMLStreamWriter writer)` Generate contents of the <samlp:Extensions> tag.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NS_URI

          public static final String NS_URI

      See Also:
        Constant Field Values

    - #### NS_PREFIX

          public static final String NS_PREFIX

      See Also:
        Constant Field Values

    - #### KC_KEY_INFO_ELEMENT_NAME

          public static final String KC_KEY_INFO_ELEMENT_NAME

      See Also:
        Constant Field Values

    - #### KEY_ID_ATTRIBUTE_NAME

          public static final String KEY_ID_ATTRIBUTE_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### KeycloakKeySamlExtensionGenerator

          public KeycloakKeySamlExtensionGenerator(String keyId)

  - ### Method Detail

    - #### write

          public void write(XMLStreamWriter writer)
                     throws ProcessingException

      Description copied from interface: `SamlProtocolExtensionsAwareBuilder.NodeGenerator`
      Generate contents of the <samlp:Extensions> tag. When this method is invoked, the writer has already emitted the <samlp:Extensions> start tag.
      Specified by:
        `write` in interface `SamlProtocolExtensionsAwareBuilder.NodeGenerator`
      Parameters:
        `writer` - Writer to use for producing XML output
      Throws:
        `ProcessingException` - If any exception fails

    - #### getMessageSigningKeyIdFromElement

          public static String getMessageSigningKeyIdFromElement(Element element)

      Checks that the given element is indeed a Keycloak extension `KeyInfo` element and returns a content of `MessageSigningKeyId` attribute in the given element.
      Parameters:
        `element` - Element to obtain the key info from.
      Returns:
        `null` if the element is unknown or there is `MessageSigningKeyId` attribute unset, value of the `MessageSigningKeyId` attribute otherwise.

Copyright © 2020 JBoss by Red Hat. All rights reserved.