io.vertx.ext.auth

## Class AbstractUser

- java.lang.Object
- - io.vertx.ext.auth.AbstractUser

- All Implemented Interfaces:
    io.vertx.core.shareddata.impl.ClusterSerializable, User

      public abstract class AbstractUser
      extends Object
      implements User, io.vertx.core.shareddata.impl.ClusterSerializable

  Useful base class for implementing a User object.

  This class handles the caching logic so you can concentrate on the actual authorisation logic.

  Just implement the abstract methods in your concrete sub-class.

  Author:
    Tim Fox

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractUser()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method 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.
    `protected abstract void` | `doIsPermitted(String permission, Handler<AsyncResult<Boolean>> resultHandler)`
    `User` | `isAuthorised(String authority, Handler<AsyncResult<Boolean>> resultHandler)` Is the user authorised to
    `int` | `readFromBuffer(int pos, Buffer buffer)`
    `void` | `writeToBuffer(Buffer buff)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.ext.auth.User

      `principal, setAuthProvider`

- - ### Constructor Detail

    - #### AbstractUser

          public AbstractUser()

  - ### Method Detail

    - #### isAuthorised

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

      Description copied from interface: `User`
      Is the user authorised to
      Specified by:
        `isAuthorised` in interface `User`
      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 `AsyncResult` containing the value `true` if the they has the authority or `false` otherwise.
      Returns:
        the User to enable fluent use

    - #### clearCache

          public User clearCache()

      Description copied from interface: `User`
      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.
      Specified by:
        `clearCache` in interface `User`
      Returns:
        the User to enable fluent use

    - #### writeToBuffer

          public void writeToBuffer(Buffer buff)

      Specified by:
        `writeToBuffer` in interface `io.vertx.core.shareddata.impl.ClusterSerializable`

    - #### readFromBuffer

          public int readFromBuffer(int pos,
                                    Buffer buffer)

      Specified by:
        `readFromBuffer` in interface `io.vertx.core.shareddata.impl.ClusterSerializable`

    - #### doIsPermitted

          protected abstract void doIsPermitted(String permission,
                                                Handler<AsyncResult<Boolean>> resultHandler)

Copyright © 2015. All Rights Reserved.