Class OIDCProxySupport


  • public final class OIDCProxySupport
    extends Object
    Support class for OIDC proxy related implementations.
    • Constructor Detail

      • OIDCProxySupport

        private OIDCProxySupport()
        Private constructor.
    • Method Detail

      • generateNonce

        @Nonnull
        public static String generateNonce​(@Nonnull
                                           Integer length)
        Generates a random identifier to be used as a nonce.
        Parameters:
        length - the length of the parameter.
        Returns:
        the randomly generated nonce value.
      • generateState

        @Nonnull
        public static String generateState​(@Nonnull
                                           String nonce,
                                           @Nonnull
                                           String key)

        Generate a state parameter from a nonce component and an execution key component.

        The nonce is separated from the key by a dot e.g. <nonce>.<keyHex>.

        The nonce is assumed to be already encoded in its transmission format e.g. Hex. The key is hex encoded before it is combined with the nonce. The result is assumed URL encoded e.g. inside the allowed set of URI characters or, no character in the state is from the URI reserved set.

        Parameters:
        nonce - the nonce component.
        key - the key component. The key is hex encoded before it is added to the generated state.
        Returns:
        the combined state component.
      • extractKeyFromState

        @Nonnull
        public static String extractKeyFromState​(@Nonnull
                                                 String state)
                                          throws OIDCProxyException
        Extract the key component from the state. The key is hex encoded and separated from the nonce value by a dot.
        Parameters:
        state - the state which contains both the nonce and the key dot separated.
        Returns:
        the key extracted from the state and hex decoded.
        Throws:
        OIDCProxyException - if the key component can not be found, or hex decoding fails.
      • extractNonceFromState

        @Nonnull
        public static String extractNonceFromState​(@Nonnull
                                                   String state)
                                            throws OIDCProxyException
        Extract the nonce component from the state. The nonce is separated from the key by a dot, and is assumed to be the first value of the pair.
        Parameters:
        state - the state which contains both the nonce and the key dot separated.
        Returns:
        the nonce extracted from the state.
        Throws:
        OIDCProxyException - if the nonce component can not be found.