Class MatchRule

java.lang.Object
org.wildfly.security.auth.client.MatchRule

public abstract class MatchRule extends Object
A rule used for deciding which authentication configuration to use.
Author:
David M. Lloyd
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final MatchRule
    The root rule which matches all URIs.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    equals(Object other)
    Determine whether this rule is equal to another object.
    final boolean
    Determine whether this rule is equal to another.
    Get the abstract type that this rule matches, or null if this rule does not match by abstract type.
    Get the abstract type authority that this rule matches, or null if this rule does not match by abstract type authority.
    Get the host name that this rule matches, or null if this rule does not match by host.
    org.wildfly.common.net.CidrAddress
    Get the network that this rule matches, or null if this rule does not match by network.
    Get the path name that this rule matches, or null if this rule does not match by path.
    int
    Get the port number that this rule matches, or 0 if this rule does not match by port.
    Get the protocol (scheme) that this rule matches, or null if this rule does not match by protocol.
    Get the URN name that this rule matches, or null if this rule does not match by URN.
    Get the URI user info that this rule matches, or null if this rule only matches empty URI user info.
    abstract int
    Get the hash code of this rule.
    boolean
    Determine whether this rule matches based on host name.
    boolean
    Determine whether this rule matches based on network.
    boolean
    Determine whether this rule matches based on path name.
    boolean
    Determine whether this rule matches based on port.
    boolean
    Determine whether this rule matches based on URI protocol (scheme).
    boolean
    Determine whether this rule matches based on abstract type.
    boolean
    Determine whether this rule matches based on abstract type.
    boolean
    Determine whether this rule matches based on URN name.
    boolean
    Determine whether this rule matches based on non-empty URI user info.
    final MatchRule
    matchAbstractType(String typeName, String authorityName)
    Create a new rule which is the same as this rule, but also matches the given abstract type and type authority.
    final MatchRule
    Create a new rule which is the same as this rule, but also matches the given Internet address.
    final MatchRule
    Create a new rule which is the same as this rule, but matches URIs with or without user info.
    final boolean
    matches(URI uri)
    Determine if this rule matches the given URI.
    boolean
    matches(URI uri, String abstractType, String abstractTypeAuthority)
    Determine if this rule matches the given URI, and type.
    final MatchRule
    matchHost(String hostSpec)
    Create a new rule which is the same as this rule, but also matches the given host name.
    final MatchRule
    Create a new rule which is the same as this rule, but also matches the given security domain.
    final MatchRule
    matchNetwork(org.wildfly.common.net.CidrAddress cidrAddress)
    Create a new rule which is the same as this rule, but also matches the given Internet network address.
    final MatchRule
    Create a new rule which is the same as this rule, but only matches URIs with no user info.
    final MatchRule
    matchPath(String pathSpec)
    Create a new rule which is the same as this rule, but also matches the given path name.
    final MatchRule
    matchPort(int port)
    Create a new rule which is the same as this rule, but also matches the given port number.
    final MatchRule
    matchProtocol(String protoName)
    Create a new rule which is the same as this rule, but also matches the given protocol (scheme) name.
    final MatchRule
    Create a new rule which is the same as this rule, but also matches the given URN name.
    final MatchRule
    matchUser(String userSpec)
    Create a new rule which is the same as this rule, but also matches the given URI user info.
    final String
    Get the string representation of this rule.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • ALL

      public static final MatchRule ALL
      The root rule which matches all URIs.
  • Method Details

    • equals

      public final boolean equals(Object other)
      Determine whether this rule is equal to another object. Two rules are equal if they match the same conditions.
      Overrides:
      equals in class Object
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • equals

      public final boolean equals(MatchRule other)
      Determine whether this rule is equal to another. Two rules are equal if they match the same conditions.
      Parameters:
      other - the other object
      Returns:
      true if they are equal, false otherwise
    • hashCode

      public abstract int hashCode()
      Get the hash code of this rule.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • matches

      public final boolean matches(URI uri)
      Determine if this rule matches the given URI.
      Parameters:
      uri - the URI to test
      Returns:
      true if the rule matches, false otherwise
    • matches

      public boolean matches(URI uri, String abstractType, String abstractTypeAuthority)
      Determine if this rule matches the given URI, and type.
      Parameters:
      uri - the URI to test
      abstractType - the abstract type of the connection (may be null)
      abstractTypeAuthority - the authority name of the abstract type (may be null)
      Returns:
      true if the rule matches, false otherwise
    • isProtocolMatched

      public boolean isProtocolMatched()
      Determine whether this rule matches based on URI protocol (scheme).
      Returns:
      true if the rule matches based on URI protocol, false otherwise
    • getMatchProtocol

      public String getMatchProtocol()
      Get the protocol (scheme) that this rule matches, or null if this rule does not match by protocol.
      Returns:
      the protocol, or null if there is none
    • isTypeMatched

      public boolean isTypeMatched()
      Determine whether this rule matches based on abstract type.
      Returns:
      true if the rule matches based on type, false otherwise
    • isTypeAuthorityMatched

      public boolean isTypeAuthorityMatched()
      Determine whether this rule matches based on abstract type.
      Returns:
      true if the rule matches based on type, false otherwise
    • getMatchAbstractType

      public String getMatchAbstractType()
      Get the abstract type that this rule matches, or null if this rule does not match by abstract type.
      Returns:
      the abstract type, or null if there is none
    • getMatchAbstractTypeAuthority

      public String getMatchAbstractTypeAuthority()
      Get the abstract type authority that this rule matches, or null if this rule does not match by abstract type authority.
      Returns:
      the abstract type, or null if there is none
    • matchProtocol

      public final MatchRule matchProtocol(String protoName)
      Create a new rule which is the same as this rule, but also matches the given protocol (scheme) name.
      Parameters:
      protoName - the protocol name to match
      Returns:
      the new rule
    • matchAbstractType

      public final MatchRule matchAbstractType(String typeName, String authorityName)
      Create a new rule which is the same as this rule, but also matches the given abstract type and type authority.
      Parameters:
      typeName - the type to match
      authorityName - the type authority name to match
      Returns:
      the new rule
    • isHostMatched

      public boolean isHostMatched()
      Determine whether this rule matches based on host name.
      Returns:
      true if the rule matches based on host name, false otherwise
    • getMatchHost

      public String getMatchHost()
      Get the host name that this rule matches, or null if this rule does not match by host.
      Returns:
      the host name, or null if there is none
    • isNetworkMatched

      public boolean isNetworkMatched()
      Determine whether this rule matches based on network.
      Returns:
      true if the rule matches based on network, false otherwise
    • getMatchNetwork

      public org.wildfly.common.net.CidrAddress getMatchNetwork()
      Get the network that this rule matches, or null if this rule does not match by network.
      Returns:
      the network that this rule matches, or null if there is none
    • matchHost

      public final MatchRule matchHost(String hostSpec)
      Create a new rule which is the same as this rule, but also matches the given host name. If the given string appears to be an IP address or a CIDR network specification, then it is treated as such.
      Parameters:
      hostSpec - the host name to match
      Returns:
      the new rule
    • matchAddress

      public final MatchRule matchAddress(InetAddress inetAddress)
      Create a new rule which is the same as this rule, but also matches the given Internet address.
      Parameters:
      inetAddress - the address to match
      Returns:
      the new rule
    • matchNetwork

      public final MatchRule matchNetwork(org.wildfly.common.net.CidrAddress cidrAddress)
      Create a new rule which is the same as this rule, but also matches the given Internet network address.
      Parameters:
      cidrAddress - the network to match
      Returns:
      the new rule
    • isPathMatched

      public boolean isPathMatched()
      Determine whether this rule matches based on path name.
      Returns:
      true if the rule matches based on path name, false otherwise
    • getMatchPath

      public String getMatchPath()
      Get the path name that this rule matches, or null if this rule does not match by path.
      Returns:
      the path name, or null if there is none
    • matchPath

      public final MatchRule matchPath(String pathSpec)
      Create a new rule which is the same as this rule, but also matches the given path name.
      Parameters:
      pathSpec - the path name to match
      Returns:
      the new rule
    • isPortMatched

      public boolean isPortMatched()
      Determine whether this rule matches based on port.
      Returns:
      true if the rule matches based on port, false otherwise
    • getMatchPort

      public int getMatchPort()
      Get the port number that this rule matches, or 0 if this rule does not match by port.
      Returns:
      the port number, or 0 if there is none
    • matchPort

      public final MatchRule matchPort(int port)
      Create a new rule which is the same as this rule, but also matches the given port number. The port number must be between 1 and 65535 (inclusive).
      Parameters:
      port - the port to match
      Returns:
      the new rule
    • isUserMatched

      public boolean isUserMatched()
      Determine whether this rule matches based on non-empty URI user info.
      Returns:
      true if the rule matches based on non-empty user info, false otherwise
    • getMatchUser

      public String getMatchUser()
      Get the URI user info that this rule matches, or null if this rule only matches empty URI user info.
      Returns:
      the user info, or null if there is none
    • matchUser

      public final MatchRule matchUser(String userSpec)
      Create a new rule which is the same as this rule, but also matches the given URI user info.
      Parameters:
      userSpec - the user info to match
      Returns:
      the new rule
    • matchNoUser

      public final MatchRule matchNoUser()
      Create a new rule which is the same as this rule, but only matches URIs with no user info.
      Returns:
      the new rule
    • matchAnyUser

      public final MatchRule matchAnyUser()
      Create a new rule which is the same as this rule, but matches URIs with or without user info.
      Returns:
      the new rule
    • isUrnNameMatched

      public boolean isUrnNameMatched()
      Determine whether this rule matches based on URN name.
      Returns:
      true if the rule matches based on URN name, false otherwise
    • getMatchUrnName

      public String getMatchUrnName()
      Get the URN name that this rule matches, or null if this rule does not match by URN.
      Returns:
      the URN name, or null if there is none
    • matchUrnName

      public final MatchRule matchUrnName(String name)
      Create a new rule which is the same as this rule, but also matches the given URN name.
      Parameters:
      name - the URN name to match
      Returns:
      the new rule
    • matchLocalSecurityDomain

      public final MatchRule matchLocalSecurityDomain(String name)
      Create a new rule which is the same as this rule, but also matches the given security domain.
      Parameters:
      name - the security domain name to match
      Returns:
      the new rule
    • toString

      public final String toString()
      Get the string representation of this rule.
      Overrides:
      toString in class Object
      Returns:
      the string representation of this rule