Interface PrincipalProvider

  • All Known Implementing Classes:
    CompositePrincipalProvider, EmptyPrincipalProvider

    public interface PrincipalProvider
    The PrincipalProvider defines methods to provide access to sources of Principals. This allows the security framework share any external sources for authorization and authentication, as may be used by a custom LoginModule for example. A single PrincipalProvider implementation is expected to exposed principals from one single source. In contrast to the PrincipalManager which will expose all known and accessible principals from possibly different sources. See also CompositePrincipalProvider for a mechanism to combine principals of different providers.
    • Method Detail

      • getPrincipal

        @Nullable Principal getPrincipal​(@NotNull
                                         @NotNull String principalName)
        Returns the principal with the specified name or null if the principal does not exist.
        principalName - the name of the principal to retrieve
        return the requested principal or null
      • getItemBasedPrincipal

        default @Nullable ItemBasedPrincipal getItemBasedPrincipal​(@NotNull
                                                                   @NotNull String principalOakPath)
        Returns the ItemBasedPrincipal with the specified principalOakPath or null if no principal with that path exists.
        principalOakPath - the Oak path of the ItemBasedPrincipal to retrieve
        return the requested principal or null
      • getMembershipPrincipals

        default @NotNull Set<Principal> getMembershipPrincipals​(@NotNull
                                                                @NotNull Principal principal)
        Returns an iterator over all group principals for which the given principal is either direct or indirect member of. Thus for any principal returned in the iterator GroupPrincipal.isMember(Principal) must return true.

        If Principal is member of Group A, and Group A is member of Group B, this method will return Group A and Group B.

        principal - the principal to return it's membership from.
        an iterator returning all groups the given principal is member of.
        See Also:
      • getPrincipals

        @NotNull Set<? extends Principal> getPrincipals​(@NotNull
                                                        @NotNull String userID)
        Tries to resolve the specified userID to a valid principal and it's group membership. This method returns an empty set if the specified ID cannot be resolved.
        userID - A userID.
        The set of principals associated with the specified userID or an empty set if it cannot be resolved.
      • findPrincipals

        default @NotNull Iterator<? extends Principal> findPrincipals​(@Nullable
                                                                      @Nullable String nameHint,
                                                                      boolean fullText,
                                                                      int searchType,
                                                                      long offset,
                                                                      long limit)
        Find the principals that match the specified nameHint and search type.
        nameHint - A name hint to use for non-exact matching.
        fullText - hint to use a full text query for search
        searchType - Limit the search to certain types of principals. Valid values are any of
        offset - Offset from where to start returning results. 0 for no offset.
        limit - Maximal number of results to return. -1 for no limit.
        An iterator of principals.
        IllegalArgumentException - if offset is negative