-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
135 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: docker/setup-qemu-action@v1 | ||
|
||
- uses: docker/setup-buildx-action@v1 | ||
|
||
- id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: mher/flower | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- uses: docker/login-action@v1 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,8 @@ auth | |
~~~~ | ||
|
||
Enables authentication. `auth` is a regexp of emails to grant access. | ||
For security reasons `auth` only supports a basic regex syntax: single email (`[email protected]`), | ||
wildcard (`.*@example.com`) or list of emails separated by pipes (`[email protected]|[email protected]`). | ||
For more info see :ref:`authentication`. | ||
|
||
.. _auto_refresh: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
mock | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from tests.unit import AsyncHTTPTestCase | ||
|
||
from flower.views.auth import authenticate, validate_auth_option | ||
|
||
class BasicAuthTests(AsyncHTTPTestCase): | ||
def test_with_single_creds(self): | ||
|
@@ -21,3 +21,41 @@ def test_with_multiple_creds(self): | |
self.assertEqual(200, r.code) | ||
r = self.fetch('/', auth_username='user1', auth_password='pswd2') | ||
self.assertEqual(401, r.code) | ||
|
||
|
||
class AuthTests(AsyncHTTPTestCase): | ||
def test_validate_auth_option(self): | ||
self.assertTrue(validate_auth_option("[email protected]")) | ||
self.assertTrue(validate_auth_option(".*@example.com")) | ||
self.assertTrue(validate_auth_option("one.*@example.com")) | ||
self.assertTrue(validate_auth_option("one.*[email protected]")) | ||
self.assertFalse(validate_auth_option(".*@.*example.com")) | ||
self.assertFalse(validate_auth_option("[email protected]|.*@domain2.com")) | ||
self.assertTrue(validate_auth_option("[email protected]|[email protected]")) | ||
self.assertFalse(validate_auth_option("mail@.*example.com")) | ||
self.assertFalse(validate_auth_option(".*example.com")) | ||
|
||
def test_authenticate_single_email(self): | ||
self.assertTrue(authenticate("[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]", "")) | ||
self.assertFalse(authenticate("[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]", "*")) | ||
|
||
def test_authenticate_email_list(self): | ||
self.assertTrue(authenticate("[email protected]|[email protected]", "[email protected]")) | ||
self.assertTrue(authenticate("[email protected]|[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]|[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]|[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]|[email protected]", "[email protected]")) | ||
self.assertFalse(authenticate("[email protected]|[email protected]", "")) | ||
self.assertFalse(authenticate("[email protected]|[email protected]", "*")) | ||
|
||
def test_authenticate_wildcard_email(self): | ||
self.assertTrue(authenticate(".*@example.com", "[email protected]")) | ||
self.assertTrue(authenticate("one.*@example.com", "[email protected]")) | ||
self.assertTrue(authenticate("one.*@example.com", "[email protected]")) | ||
self.assertFalse(authenticate(".*@example.com", "[email protected]")) | ||
self.assertFalse(authenticate(".*@corp.example.com", "[email protected]")) | ||
self.assertFalse(authenticate(".*@corp\.example\.com", "[email protected]")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters