-
-
Notifications
You must be signed in to change notification settings - Fork 986
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into web/use-types-file
* main: website/docs: ensure yaml code blocks have language tags (#9240) blueprints: only create default brand if no other default brand exists (#9222) web: bump API Client version (#9239) website/integrations: portainer: Fix Redirect URL mismatch (#9226) api: fix authentication schema (#9238) translate: Updates for file web/xliff/en.xlf in zh_CN (#9229) translate: Updates for file web/xliff/en.xlf in zh-Hans (#9230) translate: Updates for file locale/en/LC_MESSAGES/django.po in zh_CN (#9228) translate: Updates for file locale/en/LC_MESSAGES/django.po in zh-Hans (#9231) core: bump pydantic from 2.6.4 to 2.7.0 (#9232) core: bump ruff from 0.3.5 to 0.3.7 (#9233) web: bump @sentry/browser from 7.109.0 to 7.110.0 in /web in the sentry group (#9234) website: bump @types/react from 18.2.75 to 18.2.77 in /website (#9236) core, web: update translations (#9225) website/integrations: add pfSense search scope (#9221) core: bump idna from 3.6 to 3.7 (#9224) website/docs: add websocket support to nginx snippets (#9220) internal: add tests to go flow executor (#9219) website/integrations: nextcloud: add tip to solve hashed groups configuring OAuth2 (#9153) website/integrations: Jenkins, fix bolding (#9217)
- Loading branch information
Showing
62 changed files
with
889 additions
and
417 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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from os import environ | ||
|
||
import pytest | ||
|
||
from authentik import get_full_version | ||
|
||
IS_CI = "CI" in environ | ||
|
||
|
||
@pytest.hookimpl(hookwrapper=True) | ||
def pytest_sessionstart(*_, **__): | ||
"""Clear the console ahead of the pytest output starting""" | ||
if not IS_CI: | ||
print("\x1b[2J\x1b[H") | ||
yield | ||
|
||
|
||
@pytest.hookimpl(trylast=True) | ||
def pytest_report_header(*_, **__): | ||
"""Add authentik version to pytest output""" | ||
return [f"authentik version: {get_full_version()}"] |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package flow_test | ||
|
||
import ( | ||
"context" | ||
"encoding/base64" | ||
"fmt" | ||
"strconv" | ||
"testing" | ||
|
||
"github.com/gorilla/securecookie" | ||
"github.com/sirupsen/logrus" | ||
"github.com/stretchr/testify/assert" | ||
"goauthentik.io/api/v3" | ||
"goauthentik.io/internal/outpost/flow" | ||
) | ||
|
||
func testSecret() string { | ||
return base64.RawURLEncoding.EncodeToString(securecookie.GenerateRandomKey(32)) | ||
} | ||
|
||
func TestFlowExecutor_SetSecrets_Plain(t *testing.T) { | ||
fe := flow.NewFlowExecutor(context.TODO(), "", api.NewConfiguration(), logrus.Fields{}) | ||
pw := testSecret() | ||
fe.SetSecrets(pw, false) | ||
assert.Equal(t, pw, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, pw, fe.Answers[flow.StageAuthenticatorValidate]) | ||
} | ||
|
||
func TestFlowExecutor_SetSecrets_TOTP_6(t *testing.T) { | ||
fe := flow.NewFlowExecutor(context.TODO(), "", api.NewConfiguration(), logrus.Fields{}) | ||
pw := testSecret() | ||
totp := 123456 | ||
formatted := fmt.Sprintf("%s%s%d", pw, flow.CodePasswordSeparator, totp) | ||
fe.SetSecrets(formatted, true) | ||
assert.Equal(t, pw, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, strconv.Itoa(totp), fe.Answers[flow.StageAuthenticatorValidate]) | ||
} | ||
|
||
func TestFlowExecutor_SetSecrets_TOTP_8(t *testing.T) { | ||
fe := flow.NewFlowExecutor(context.TODO(), "", api.NewConfiguration(), logrus.Fields{}) | ||
pw := testSecret() | ||
totp := 12345678 | ||
formatted := fmt.Sprintf("%s%s%d", pw, flow.CodePasswordSeparator, totp) | ||
fe.SetSecrets(formatted, true) | ||
assert.Equal(t, pw, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, strconv.Itoa(totp), fe.Answers[flow.StageAuthenticatorValidate]) | ||
} | ||
|
||
func TestFlowExecutor_SetSecrets_TOTP_TooLong(t *testing.T) { | ||
fe := flow.NewFlowExecutor(context.TODO(), "", api.NewConfiguration(), logrus.Fields{}) | ||
pw := testSecret() | ||
totp := 1234567890 | ||
formatted := fmt.Sprintf("%s%s%d", pw, flow.CodePasswordSeparator, totp) | ||
fe.SetSecrets(formatted, true) | ||
assert.Equal(t, formatted, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, "", fe.Answers[flow.StageAuthenticatorValidate]) | ||
} | ||
|
||
func TestFlowExecutor_SetSecrets_TOTP_NoCode(t *testing.T) { | ||
fe := flow.NewFlowExecutor(context.TODO(), "", api.NewConfiguration(), logrus.Fields{}) | ||
pw := testSecret() | ||
fe.SetSecrets(pw, true) | ||
assert.Equal(t, pw, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, "", fe.Answers[flow.StageAuthenticatorValidate]) | ||
fe.SetSecrets(pw+flow.CodePasswordSeparator, true) | ||
assert.Equal(t, pw, fe.Answers[flow.StagePassword]) | ||
assert.Equal(t, "", fe.Answers[flow.StageAuthenticatorValidate]) | ||
} |
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
Binary file not shown.
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
Oops, something went wrong.