AuthCodeController class

HTTPController for issuing OAuth 2.0 authorization codes.

This controller provides the necessary methods for issuing OAuth 2.0 authorization codes: returning a HTML login form and issuing a request for an authorization code. The login form's submit button should initiate the request for the authorization code.

This controller should be routed to by a pattern like /auth/code. It will respond to POST and GET HTTP methods. Do not put an Authorizer in front of instances of this type. Example:

  router.route("/auth/token").generate(() => new AuthCodeController(authServer));

See getAuthorizationPage (GET) and authorize (POST) for more details.

Inheritance

Constructors

AuthCodeController(AuthServer authServer, { Future<String> renderAuthorizationPageHTML(AuthCodeController controller, Uri requestURI, Map<String, String> queryParameters) })
Creates a new instance of an AuthCodeController. [...]

Properties

authServer AuthServer
A reference to the AuthServer this controller uses to grant authorization codes.
read / write
clientID String
The client ID of the authenticating client. [...]
@HTTPQuery("client_id"), read / write
responseType String
The desired response type; must be 'code'.
@HTTPQuery("response_type"), read / write
state String
The state parameter a client uses to verify the origin of a redirect when receiving an authorization redirect. [...]
@HTTPQuery("state"), read / write
acceptedContentTypes List<ContentType>
Types of content this HTTPController will accept. [...]
read / write, inherited
documentableChild APIDocumentable
Returns the next documentable object in a chain of documentable objects. [...]
read-only, inherited
hashCode int
The hash code for this object. [...]
read-only, inherited
logger Logger
An instance of the 'aqueduct' logger.
read-only, inherited
nextController RequestController
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
request Request
The request being processed by this HTTPController. [...]
read / write, inherited
responseContentType ContentType
The default content type of responses from this HTTPController. [...]
read / write, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

authorize({String username, String password, String scope }) Future<Response>
Creates a one-time use authorization code. [...]
@httpPost
documentOperations(PackagePathResolver resolver) List<APIOperation>
documentResponsesForOperation(APIOperation operation) List<APIResponse>
getAuthorizationPage({String scope }) Future<Response>
Returns an HTML login form. [...]
@httpGet
willSendResponse(Response resp) → void
Executed prior to Response being sent. [...]
applyCORSHeadersIfNecessary(Request req, Response resp) → void
inherited
didDecodeRequestBody(HTTPRequestBody decodedObject) → void
Callback to indicate when a request body has been processed. [...]
inherited
documentAPI(PackagePathResolver resolver) APIDocument
Returns an entire APIDocument describing an OpenAPI specification. [...]
inherited
documentPaths(PackagePathResolver resolver) List<APIPath>
Returns all APIPath objects this instance knows about. [...]
inherited
documentRequestBodyForOperation(APIOperation operation) APIRequestBody
Returns all APIRequestBodys for operation.
inherited
documentSecuritySchemes(PackagePathResolver resolver) Map<String, APISecurityScheme>
Returns all APISecuritySchemes this instance knows about.
inherited
generate(RequestController instantiator()) RequestController
Sets the nextController that will receive a request after this one. [...]
inherited
handleError(Request request, dynamic caughtValue, StackTrace trace) Future<bool>
Sends an HTTP response for a request that yields an exception or error. [...]
inherited
listen(FutureOr<RequestOrResponse> process(Request request)) RequestController
Sets the nextController that will receive a request after this one. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
pipe(RequestController next) RequestController
Sets the nextController that will receive a request after this one. [...]
inherited
processRequest(Request req) Future<RequestOrResponse>
Overridden by subclasses to modify or respond to an incoming request. [...]
inherited
receive(Request req) Future
Delivers req to this instance to be processed. [...]
inherited
toString() String
Returns a string representation of this object.
inherited
willDecodeRequestBody(HTTPRequestBody body) → void
Callback invoked prior to decoding a request body. [...]
inherited
willProcessRequest(Request req) FutureOr<RequestOrResponse>
Executed prior to handling a request, but after the request has been set. [...]
inherited

Operators

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