Class JWKSourceWithFailover<C extends SecurityContext>

  • All Implemented Interfaces:
    JWKSource<C>, java.io.Closeable, java.lang.AutoCloseable

    @ThreadSafe
    public class JWKSourceWithFailover<C extends SecurityContext>
    extends java.lang.Object
    implements JWKSource<C>, java.io.Closeable
    JWK source with optional failover.
    Version:
    2022-08-24
    Author:
    Thomas Rørvik Skjølberg, Vladimir Dzhuvinov
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      java.util.List<JWK> get​(JWKSelector jwkSelector, C context)
      Retrieves a list of JWKs matching the specified selector.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JWKSourceWithFailover

        public JWKSourceWithFailover​(JWKSource<C> jwkSource,
                                     JWKSource<C> failoverJWKSource)
        Creates a new JWK source with optional failover.
        Parameters:
        jwkSource - The primary JWK source. Must not be null.
        failoverJWKSource - Optional failover JWK source if retrieval from the primary JWK source fails, null if no failover.
    • Method Detail

      • get

        public java.util.List<JWK> get​(JWKSelector jwkSelector,
                                       C context)
                                throws KeySourceException
        Description copied from interface: JWKSource
        Retrieves a list of JWKs matching the specified selector.
        Specified by:
        get in interface JWKSource<C extends SecurityContext>
        Parameters:
        jwkSelector - A JWK selector. Must not be null.
        context - Optional context, null if not required.
        Returns:
        The matching JWKs, empty list if no matches were found.
        Throws:
        KeySourceException - If key sourcing failed.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable