Interface PrincipalDecoder

    • Method Detail

      • getName

        String getName​(Principal principal)
        Get the name from a principal. If this decoder cannot understand the given principal type or contents, null is returned.
        Parameters:
        principal - the principal to decode
        Returns:
        the name, or null if this decoder does not understand the principal
      • asPrincipalRewriter

        default UnaryOperator<Principal> asPrincipalRewriter()
        Get this principal decoder as a principal rewriter that produces a NamePrincipal if the decode succeeds.
        Returns:
        the rewriter (not null)
      • withRewriter

        default PrincipalDecoder withRewriter​(NameRewriter nameRewriter)
        Add a name rewriter to this principal decoder. If the name is decoded, it will then be rewritten with the given rewriter. If the rewriter deems the name invalid, then the name will be considered not decoded.
        Parameters:
        nameRewriter - the name rewriter
        Returns:
        the combined decoder
      • aggregate

        static PrincipalDecoder aggregate​(PrincipalDecoder... decoders)
        Create an aggregated credential decoder. The aggregated decoder will check each credential decoder until one matches the credential; this result will be returned.
        Parameters:
        decoders - the constituent decoders
        Returns:
        the aggregated decoder
      • concatenating

        static PrincipalDecoder concatenating​(PrincipalDecoder former,
                                              String joinString,
                                              PrincipalDecoder latter)
        Create a principal decoder which concatenates the results of two principal decoders. If one decoder is not able to decode the principal, null is returned.
        Parameters:
        former - the former decoder
        joinString - the string to use to join the results
        latter - the latter decoder
        Returns:
        the concatenated result
      • concatenating

        static PrincipalDecoder concatenating​(String joinString,
                                              PrincipalDecoder... decoders)
        Create a principal decoder that concatenates the results of the given principal decoders in the order in which they're given. If any decoder is not able to decode the principal, then null is returned.
        Parameters:
        joinString - the string to use to join the results
        decoders - the principal decoders (must not be null, cannot have null elements)
        Returns:
        the concatenating decoder
      • constant

        static PrincipalDecoder constant​(String name)
        Create a principal decoder which always returns the same name.
        Parameters:
        name - the name to return
        Returns:
        the constant decoder