AuthController class

Controller for issuing and refreshing OAuth 2.0 access tokens.

This controller issues and refreshes access tokens. Access tokens are issued for valid username and password (resource owner password grant) or for an authorization code (authorization code grant) from a AuthCodeController.

See operation method grant for more details.


    .link(() => new AuthController(authServer));


AuthController(AuthServer authServer)
Creates a new instance of an AuthController. [...]


authHeader String
Required basic authentication Authorization header containing client ID and secret for the authenticating client. [...]
@Bind.header(HttpHeaders.authorizationHeader), read / write
authServer AuthServer
A reference to the AuthServer this controller uses to grant tokens.
acceptedContentTypes List<ContentType>
Types of content this ResourceController will accept. [...]
read / write, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
logger Logger
An instance of the 'aqueduct' logger.
read-only, inherited
nextController Controller
Receives requests that this controller does not respond to. [...]
read-only, inherited
pathVariables Map<String, String>
Parameters parsed from the URI of the request, if any exist. [...]
read-only, inherited
policy CORSPolicy
The CORS policy of this controller.
read / write, inherited
recycledState → BoundController
Returns state information that is reused across instances of this type. [...]
read-only, inherited
request Request
The request being processed by this ResourceController. [...]
read / write, inherited
responseContentType ContentType
The default content type of responses from this ResourceController. [...]
read / write, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


documentOperationParameters(APIDocumentContext context, Operation operation) List<APIParameter>
Returns a documented list of APIParameter for operation. [...]
documentOperationRequestBody(APIDocumentContext context, Operation operation) APIRequestBody
Returns a documented request body for operation. [...]
documentOperationResponses(APIDocumentContext context, Operation operation) Map<String, APIResponse>
Returns a map of possible responses for operation. [...]
documentOperations(APIDocumentContext context, String route, APIPath path) Map<String, APIOperation>
grant({String username, String password, String refreshToken, String authCode, String grantType, String scope }) Future<Response>
Creates or refreshes an authentication token. [...]
willSendResponse(Response response) → void
Executed prior to Response being sent. [...]
applyCORSHeadersIfNecessary(Request req, Response resp) → void
didAddToChannel() → void
Lifecycle callback, invoked after added to channel, but before any requests are served. [...]
didDecodeRequestBody(RequestBody body) → void
Callback to indicate when a request body has been processed. [...]
documentComponents(APIDocumentContext context) → void
documentOperationDescription(APIDocumentContext context, Operation operation) String
Returns a documented description for operation. [...]
documentOperationSummary(APIDocumentContext context, Operation operation) String
Returns a documented summary for operation. [...]
documentOperationTags(APIDocumentContext context, Operation operation) List<String>
Returns a list of tags for operation. [...]
documentPaths(APIDocumentContext context) Map<String, APIPath>
Tells this object to return all APIPaths it handles. [...]
handle(Request request) FutureOr<RequestOrResponse>
The primary request handling method of this object. [...]
handleError(Request request, dynamic caughtValue, StackTrace trace) Future
Sends an HTTP response for a request that yields an exception or error. [...]
Links a controller to the receiver to form a request channel. [...]
linkFunction(FutureOr<RequestOrResponse> handle(Request request)) Linkable
Links a function controller to the receiver to form a request channel. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
receive(Request req) Future
Delivers req to this instance to be processed. [...]
restore(BoundController state) → void
Provides a new instance of this type with the recycledState of this type. [...]
toString() String
Returns a string representation of this object.
willDecodeRequestBody(RequestBody body) → void
Callback invoked prior to decoding a request body. [...]
willProcessRequest(Request req) FutureOr<RequestOrResponse>
Executed prior to handling a request, but after the request has been set. [...]


operator ==(dynamic other) bool
The equality operator. [...]

Static Methods

tokenResponse(AuthToken token) Response
Transforms a AuthToken into a Response object with an RFC6749 compliant JSON token as the HTTP response body.