Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update authorizeAsync.md #2746

Merged
merged 1 commit into from Oct 10, 2019
Merged

Update authorizeAsync.md #2746

merged 1 commit into from Oct 10, 2019

Conversation

@PiotrJander
Copy link
Contributor

PiotrJander commented Oct 9, 2019

The documentation got it wrong, as is evident from the source code (and common sense):

  /**
   * Asynchronous version of [[authorize]].
   * If the [[Future]] fails or is completed with `false`
   * authorization fails and the route is rejected with an [[AuthorizationFailedRejection]].
   *
   * @group security
   */
  def authorizeAsync(check: RequestContext => Future[Boolean]): Directive0 =
    extract(check).flatMap[Unit] { fa =>
      onComplete(fa).flatMap {
        case Success(true) => pass
        case _             => reject(AuthorizationFailedRejection)
      }
    }

Pull Request Checklist

The documentation got it wrong, as is evident from the source code (and common sense):

```scala
  /**
   * Asynchronous version of [[authorize]].
   * If the [[Future]] fails or is completed with `false`
   * authorization fails and the route is rejected with an [[AuthorizationFailedRejection]].
   *
   * @group security
   */
  def authorizeAsync(check: RequestContext => Future[Boolean]): Directive0 =
    extract(check).flatMap[Unit] { fa =>
      onComplete(fa).flatMap {
        case Success(true) => pass
        case _             => reject(AuthorizationFailedRejection)
      }
    }
```
@akka-ci

This comment has been minimized.

Copy link
Collaborator

akka-ci commented Oct 9, 2019

Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged.

For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask!

@johanandren

This comment has been minimized.

Copy link
Member

johanandren commented Oct 10, 2019

OK TO TEST

@akka-ci akka-ci added validating tested and removed validating labels Oct 10, 2019
@akka-ci

This comment has been minimized.

Copy link
Collaborator

akka-ci commented Oct 10, 2019

Test PASSed.

Copy link
Member

johanandren left a comment

LGTM, thanks!

Copy link
Member

jrudolph left a comment

LGTM

@jrudolph jrudolph merged commit be697b3 into akka:master Oct 10, 2019
4 checks passed
4 checks passed
Jenkins PR Auto-Formatter Successful
Details
Jenkins PR Validation Test PASSed. 498 tests run, 13 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
typesafe-cla-validator All users have signed the CLA
Details
@jrudolph

This comment has been minimized.

Copy link
Member

jrudolph commented Oct 10, 2019

Thanks, @PiotrJander.

@jrudolph jrudolph added this to the 10.1.11 milestone Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.