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
- Object
- RequestController
- HTTPController
- AuthCodeController
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
-
@override, read-only, inherited
- hashCode → int
-
The hash code for this object.
read-only, inherited - logger → Logger
-
read-only, inherited
- nextController → RequestController
-
read / write, 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
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
Creates a one-time use authorization code.
@httpPost -
documentOperations(
PackagePathResolver resolver) → List<APIOperation> -
Returns all
APIOperation
s this object knows about. -
documentResponsesForOperation(
APIOperation operation) → List<APIResponse> -
Returns all
APIResponse
s foroperation
. -
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 generatorFunction()) → RequestController -
A function that instantiates a RequestController to pass a Request to if this instance returns a Request from processRequest.
inherited -
handleError(
Request request, caughtValue, StackTrace trace) → Future<bool> -
Sends an HTTP response for a request that yields an exception or error.
inherited -
listen(
Future<RequestOrResponse> requestControllerFunction(Request request)) → RequestController -
A closure that responds to or forwards a Request.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
pipe(
RequestController n) → RequestController -
The next RequestController to pass a Request to if this instance returns a Request from processRequest.
inherited -
processRequest(
Request req) → Future<RequestOrResponse> -
Overridden by subclasses to modify or respond to an incoming request.
inherited -
receive(
Request req) → Future -
The mechanism for delivering a Request to this controller for processing.
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) → Future<RequestOrResponse> -
Executed prior to handling a request, but after the request has been set.
inherited