Package org.apache.activemq.artemis.spi.core.security

## Interface ActiveMQSecurityManager2

- All Superinterfaces:
    `ActiveMQSecurityManager`

      public interface ActiveMQSecurityManager2
      extends ActiveMQSecurityManager

  Used to validate whether a user is authorized to connect to the server and perform certain functions on certain destinations. This is an evolution of `ActiveMQSecurityManager` that adds the ability to perform authorization taking the destination address into account.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `validateUser​(java.lang.String user, java.lang.String password, java.security.cert.X509Certificate[] certificates)` | is this a valid user.
    `boolean` | `validateUserAndRole​(java.lang.String user, java.lang.String password, java.util.Set<org.apache.activemq.artemis.core.security.Role> roles, org.apache.activemq.artemis.core.security.CheckType checkType, java.lang.String address, RemotingConnection connection)` | Determine whether the given user is valid and whether they have the correct role for the given destination address.

    - ### Methods inherited from interface org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager

      `getDomain, init, validateUser, validateUserAndRole`

- - ### Method Detail

    - #### validateUser

          boolean validateUser​(java.lang.String user,
                               java.lang.String password,
                               java.security.cert.X509Certificate[] certificates)

      is this a valid user. This method is called instead of `ActiveMQSecurityManager.validateUser(String, String)`.
      Parameters:
        `user` - the user
        `password` - the users password
      Returns:
        true if a valid user

    - #### validateUserAndRole

          boolean validateUserAndRole​(java.lang.String user,
                                      java.lang.String password,
                                      java.util.Set<org.apache.activemq.artemis.core.security.Role> roles,
                                      org.apache.activemq.artemis.core.security.CheckType checkType,
                                      java.lang.String address,
                                      RemotingConnection connection)

      Determine whether the given user is valid and whether they have the correct role for the given destination address. This method is called instead of `ActiveMQSecurityManager.validateUserAndRole(String, String, Set, CheckType)`.
      Parameters:
        `user` - the user
        `password` - the user's password
        `roles` - the user's roles
        `checkType` - which permission to validate
        `address` - the address for which to perform authorization
        `connection` - the user's connection
      Returns:
        true if the user is valid and they have the correct roles for the given destination address