Interface SubjectReference


public interface SubjectReference
Represents a reference to a given subject.

SubjectReferences should be used when a subject needs to be represented, but the backing Subject is not needed.

SubjectReferences are unique to a given PermissionService, and will not resolve to the correct service if the provider changes.

Note that implementations of this interface should be capable of resolving the reference to a real subject.

Instances can be obtained using PermissionService.newSubjectReference(String, String), SubjectCollection.newSubjectReference(String) or Subject.asSubjectReference().

  • Method Details

    • collectionIdentifier

      String collectionIdentifier()
      Gets the identifier of the collection containing the subject being referenced.
      Returns:
      The identifier of the collection holding this subject
    • subjectIdentifier

      String subjectIdentifier()
      Gets the identifier of the subject.
      Returns:
      The subject identifier
    • resolve

      CompletableFuture<? extends Subject> resolve()
      Resolves and returns the Subject being referenced.

      The returned future will complete exceptionally if the subject collection with the given identifier cannot be loaded.

      Returns:
      The subject being referenced by this instance.