Interface ConnectionSubjectFactory

  • All Known Implementing Classes:
    DefaultConnectionSubjectFactory

    public interface ConnectionSubjectFactory
    A ConnectionSubjectFactory creates a Subject instance that represents the connection client's identity.

    Most implementations will simply use the Subject.Builder to create an anonymous Subject instance and let a downstream AuthenticationFilter authenticate the Subject based on any credentials associated with the connection. After authentication, the Subject will have an identity, and this is the expected flow for most connection clients.

    However, if there is some other data associated with the connection that can be inspected to create a Subject instance beyond what the DefaultConnectionSubjectFactory provides, this interface allows that logic to be plugged in as necessary.

    Since:
    5.10.0
    See Also:
    DefaultConnectionSubjectFactory
    • Method Detail

      • createSubject

        org.apache.shiro.subject.Subject createSubject​(ConnectionReference ref)
        Creates a Subject instance representing the connection client. It is common for Subject instances returned from this method to be anonymous until a downstream AuthenticationFilter authenticates the subject to associate an identity.
        Parameters:
        ref - a reference to the client's connection metadata
        Returns:
        a Subject instance representing the connection client.