Package: io.vertx.groovy.ext.auth

## [Groovy] Class User

- io.vertx.groovy.ext.auth.User

- Represents an authenticates User and contains operations to authorise the user.

  Please consult the documentation for a detailed explanation.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `User (Object delegate)`

  - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `User` | `clearCache()` The User object will cache any authorities that it knows it has to avoid hitting the underlying auth provider each time.
    `Object` | `getDelegate()`
    `User` | `isAuthorised(String authority, Handler<AsyncResult<Boolean>> resultHandler)` Is the user authorised to
    `Map<String, Object>` | `principal()` Get the underlying principal for the User.
    `void` | `setAuthProvider(AuthProvider authProvider)` Set the auth provider for the User.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Constructor Detail

    - #### User(Object delegate)

  - ### Method Detail

    - #### User clearCache()

      The User object will cache any authorities that it knows it has to avoid hitting the underlying auth provider each time. Use this method if you want to clear this cache.

      Returns:
        the User to enable fluent use

    - #### Object getDelegate()

    - #### User isAuthorised(String authority, Handler<AsyncResult<Boolean>> resultHandler)

      Is the user authorised to

      Returns:
        the User to enable fluent use
      Parameters:
        `authority` - the authority - what this really means is determined by the specific implementation. It might represent a permission to access a resource e.g. `printers:printer34` or it might represent authority to a role in a roles based model, e.g. `role:admin`.
        `resultHandler` - handler that will be called with an io.vertx.groovy.core.AsyncResult containing the value `true` if the they has the authority or `false` otherwise.

    - #### Map<String, Object> principal()

      Get the underlying principal for the User. What this actually returns depends on the implementation. For a simple user/password based auth, it's likely to contain a JSON object with the following structure:

             {
               "username", "tim"
             }

      Returns:
        JSON representation of the Principal

    - #### void setAuthProvider(AuthProvider authProvider)

      Set the auth provider for the User. This is typically used to reattach a detached User with an AuthProvider, e.g. after it has been deserialized.

      Parameters:
        `authProvider` - the AuthProvider - this must be the same type of AuthProvider that originally created the User