Skip to content
This repository was archived by the owner on Mar 18, 2021. It is now read-only.
This repository was archived by the owner on Mar 18, 2021. It is now read-only.

BasicValidator implements AuthValidator - aqueduct document error #932

Open

Description

@robotoss

I tried to write my own authorization:

class BasicValidator implements AuthValidator {
  @override
  List<APISecurityRequirement> documentRequirementsForAuthorizer(
      APIDocumentContext context, Authorizer authorizer,
      {List<AuthScope> scopes}) {
    return [
      APISecurityRequirement({"securitySchemes": []})
    ];
  }

  @override
  FutureOr<Authorization> validate<T>(
      AuthorizationParser<T> parser, T authorizationData,
      {List<AuthScope> requiredScope}) {
    final userId = SecurityHelper().userIdByToken(authorizationData.toString());
    if (userId != null) {
      return Authorization(
        userId.toString(),
        null,
        this,
      );
    }
    return null;
  }

The code works when the server starts up.
But when I try to use the command - aqueduct document. I get an error

PS C:\aqueductProjects\aqueduct_pd> aqueduct document
-- Aqueduct CLI Version: 4.0.0-b1
-- Aqueduct project version: 4.0.0-b1
*** Uncaught error
Bad state: NoSuchMethodError: The getter 'type' was called on null.
Receiver: null
Tried calling: type
**** Stacktrace


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions