authentik
authentik copied to clipboard
web: Add initial SDK for embedding
Details
REPLACE ME
Checklist
- [ ] Local tests pass (
ak test authentik/) - [ ] The code has been formatted (
make lint-fix)
If an API change has been made
- [ ] The API schema has been updated (
make gen-build)
If changes to the frontend have been made
- [ ] The code has been formatted (
make web)
If applicable
- [ ] The documentation has been updated
- [ ] The documentation has been formatted (
make website)
Deploy Preview for authentik-storybook failed.
| Name | Link |
|---|---|
| Latest commit | a407d903ab3c9d639ac984ef40f8d5ea2b9201d0 |
| Latest deploy log | https://app.netlify.com/sites/authentik-storybook/deploys/67056ac31fe3bb0008d7c578 |
Deploy Preview for authentik-docs ready!
| Name | Link |
|---|---|
| Latest commit | a407d903ab3c9d639ac984ef40f8d5ea2b9201d0 |
| Latest deploy log | https://app.netlify.com/sites/authentik-docs/deploys/67056ac39fb7c50008516554 |
| Deploy Preview | https://deploy-preview-11174--authentik-docs.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
:x: 8 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 1535 | 8 | 1527 | 1 |
View the top 3 failed tests by shortest run time
authentik.providers.oauth2.tests.test_token.TestToken test_refresh_token_viewStack Traces | 0.829s run time
self = <unittest.case._Outcome object at 0x7f0c173c7650> test_case = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> result = <TestCaseFunction test_refresh_token_view> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:634: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> method = <bound method TestToken.test_refresh_token_view of <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:589: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view>,) kwargs = {}, file = 'system/providers-oauth2.yaml' content = 'version: 1\nmetadata:\n labels:\n blueprints.goauthentik.io/system: "true"\n name: System - OAuth2 Provider - Sc... application the ability to access the authentik API\n # on behalf of the authorizing user\n return {}\n' @wraps(func) def wrapper(*args, **kwargs): for file in files: content = BlueprintInstance(path=file).retrieve() Importer.from_string(content).apply() > return func(*args, **kwargs) .../blueprints/tests/__init__.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> @apply_blueprint("system/providers-oauth2.yaml") def test_refresh_token_view(self): """test request param""" provider = OAuth2Provider.objects.create( name=generate_id(), authorization_flow=create_test_flow(), redirect_uris="http://local.invalid", signing_key=self.keypair, ) provider.property_mappings.set( ScopeMapping.objects.filter( managed__in=[ "goauthentik..../providers/oauth2/scope-openid", "goauthentik..../providers/oauth2/scope-email", "goauthentik..../providers/oauth2/scope-profile", "goauthentik..../providers/oauth2/scope-offline_access", ] ) ) # Needs to be assigned to an application for iss to be set self.app.provider = provider self.app.save() header = b64encode(f"{provider.client_id}:{provider.client_secret}".encode()).decode() user = create_test_admin_user() token: RefreshToken = RefreshToken.objects.create( provider=provider, user=user, token=generate_id(), _id_token=dumps({}), auth_time=timezone.now(), _scope="offline_access", ) response = self.client.post( reverse("authentik_providers_oauth2:token"), data={ "grant_type": GRANT_TYPE_REFRESH_TOKEN, "refresh_token": token.token, "redirect_uri": "http://local.invalid", }, HTTP_AUTHORIZATION=f"Basic {header}", HTTP_ORIGIN="http://local.invalid", ) self.assertEqual(response["Access-Control-Allow-Credentials"], "true") > self.assertEqual(response["Access-Control-Allow-Origin"], "http://local.invalid") .../oauth2/tests/test_token.py:198: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> first = 'http://localhost:8080', second = 'http://local.invalid', msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:885: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> first = 'http://localhost:8080', second = 'http://local.invalid', msg = None def assertMultiLineEqual(self, first, second, msg=None): """Assert that two multi-line strings are equal.""" self.assertIsInstance(first, str, "First argument is not a string") self.assertIsInstance(second, str, "Second argument is not a string") if first != second: # Don't use difflib if the strings are too long if (len(first) > self._diffThreshold or len(second) > self._diffThreshold): self._baseAssertEqual(first, second, msg) # Append \n to both strings if either is missing the \n. # This allows the final ndiff to show the \n difference. The # exception here is if the string is empty, in which case no # \n should be added first_presplit = first second_presplit = second if first and second: if first[-1] != '\n' or second[-1] != '\n': first_presplit += '\n' second_presplit += '\n' elif second and second[-1] != '\n': second_presplit += '\n' elif first and first[-1] != '\n': first_presplit += '\n' firstlines = first_presplit.splitlines(keepends=True) secondlines = second_presplit.splitlines(keepends=True) # Generate the message and diff, then raise the exception standardMsg = '%s != %s' % _common_shorten_repr(first, second) diff = '\n' + ''.join(difflib.ndiff(firstlines, secondlines)) standardMsg = self._truncateMessage(standardMsg, diff) > self.fail(self._formatMessage(msg, standardMsg)) .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:1251: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view> msg = "'http://localhost:8080' != 'http://local.invalid'\n- http://localhost:8080\n+ http://local.invalid\n" def fail(self, msg=None): """Fail immediately, with the given message.""" > raise self.failureException(msg) E AssertionError: 'http://localhost:8080' != 'http://local.invalid' E - http://localhost:8080 E + http://local.invalid .../hostedtoolcache/Python/3.12.6................../x64/lib/python3.12/unittest/case.py:715: AssertionError
authentik.providers.oauth2.tests.test_token.TestToken test_refresh_token_view_invalid_originStack Traces | 1.52s run time
self = <unittest.case._Outcome object at 0x7f0c16cf8920> test_case = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> result = <TestCaseFunction test_refresh_token_view_invalid_origin> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:634: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> method = <bound method TestToken.test_refresh_token_view_invalid_origin of <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:589: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin>,) kwargs = {}, file = 'system/providers-oauth2.yaml' content = 'version: 1\nmetadata:\n labels:\n blueprints.goauthentik.io/system: "true"\n name: System - OAuth2 Provider - Sc... application the ability to access the authentik API\n # on behalf of the authorizing user\n return {}\n' @wraps(func) def wrapper(*args, **kwargs): for file in files: content = BlueprintInstance(path=file).retrieve() Importer.from_string(content).apply() > return func(*args, **kwargs) .../blueprints/tests/__init__.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> @apply_blueprint("system/providers-oauth2.yaml") def test_refresh_token_view_invalid_origin(self): """test request param""" provider = OAuth2Provider.objects.create( name=generate_id(), authorization_flow=create_test_flow(), redirect_uris="http://local.invalid", signing_key=self.keypair, ) provider.property_mappings.set( ScopeMapping.objects.filter( managed__in=[ "goauthentik..../providers/oauth2/scope-openid", "goauthentik..../providers/oauth2/scope-email", "goauthentik..../providers/oauth2/scope-profile", "goauthentik..../providers/oauth2/scope-offline_access", ] ) ) header = b64encode(f"{provider.client_id}:{provider.client_secret}".encode()).decode() user = create_test_admin_user() token: RefreshToken = RefreshToken.objects.create( provider=provider, user=user, token=generate_id(), _id_token=dumps({}), auth_time=timezone.now(), _scope="offline_access", ) response = self.client.post( reverse("authentik_providers_oauth2:token"), data={ "grant_type": GRANT_TYPE_REFRESH_TOKEN, "refresh_token": token.token, "redirect_uri": "http://local.invalid", }, HTTP_AUTHORIZATION=f"Basic {header}", HTTP_ORIGIN="http://another.invalid", ) access: AccessToken = AccessToken.objects.filter(user=user, provider=provider).first() refresh: RefreshToken = RefreshToken.objects.filter( user=user, provider=provider, revoked=False ).first() > self.assertNotIn("Access-Control-Allow-Credentials", response) .../oauth2/tests/test_token.py:260: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> member = 'Access-Control-Allow-Credentials' container = <TokenResponse status_code=200, "application/json">, msg = None def assertNotIn(self, member, container, msg=None): """Just like self.assertTrue(a not in b), but with a nicer default message.""" if member in container: standardMsg = '%s unexpectedly found in %s' % (safe_repr(member), safe_repr(container)) > self.fail(self._formatMessage(msg, standardMsg)) .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:1159: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <authentik.providers.oauth2.tests.test_token.TestToken testMethod=test_refresh_token_view_invalid_origin> msg = '\'Access-Control-Allow-Credentials\' unexpectedly found in <TokenResponse status_code=200, "application/json">' def fail(self, msg=None): """Fail immediately, with the given message.""" > raise self.failureException(msg) E AssertionError: 'Access-Control-Allow-Credentials' unexpectedly found in <TokenResponse status_code=200, "application/json"> .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:715: AssertionError
tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 test_oauth_linkStack Traces | 19.7s run time
self = <unittest.case._Outcome object at 0x7f97f084cf80> test_case = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> subTest = False @contextlib.contextmanager def testPartExecutor(self, test_case, subTest=False): old_success = self.success self.success = True try: > yield .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:58: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> result = <TestCaseFunction test_oauth_link> def run(self, result=None): if result is None: result = self.defaultTestResult() startTestRun = getattr(result, 'startTestRun', None) stopTestRun = getattr(result, 'stopTestRun', None) if startTestRun is not None: startTestRun() else: stopTestRun = None result.startTest(self) try: testMethod = getattr(self, self._testMethodName) if (getattr(self.__class__, "__unittest_skip__", False) or getattr(testMethod, "__unittest_skip__", False)): # If the class or method was skipped. skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') or getattr(testMethod, '__unittest_skip_why__', '')) _addSkip(result, self, skip_why) return result expecting_failure = ( getattr(self, "__unittest_expecting_failure__", False) or getattr(testMethod, "__unittest_expecting_failure__", False) ) outcome = _Outcome(result) start_time = time.perf_counter() try: self._outcome = outcome with outcome.testPartExecutor(self): self._callSetUp() if outcome.success: outcome.expecting_failure = expecting_failure with outcome.testPartExecutor(self): > self._callTestMethod(testMethod) .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:634: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> method = <bound method TestSourceOAuth2.test_oauth_link of <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link>> def _callTestMethod(self, method): > if method() is not None: .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:589: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> args = (), kwargs = {} @wraps(func) def wrapper(self: TransactionTestCase, *args, **kwargs): """Run test again if we're below max_retries, including tearDown and setUp. Otherwise raise the error""" nonlocal count try: > return func(self, *args, **kwargs) tests/e2e/utils.py:253: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link>,) kwargs = {}, file = 'default/flow-default-invalidation-flow.yaml' content = 'version: 1\nmetadata:\n name: Default - Invalidation flow\nentries:\n- attrs:\n designation: invalidation\n na...0\n stage: !KeyOf default-invalidation-logout\n target: !KeyOf flow\n model: authentik_flows.flowstagebinding\n' @wraps(func) def wrapper(*args, **kwargs): for file in files: content = BlueprintInstance(path=file).retrieve() Importer.from_string(content).apply() > return func(*args, **kwargs) .../blueprints/tests/__init__.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link>,) kwargs = {}, file = 'default/flow-default-source-pre-authentication.yaml' content = 'version: 1\nmetadata:\n name: Default - Source pre-authentication flow\nentries:\n- attrs:\n designation: stage_c... authentication: none\n identifiers:\n slug: default-source-pre-authentication\n model: authentik_flows.flow\n' @wraps(func) def wrapper(*args, **kwargs): for file in files: content = BlueprintInstance(path=file).retrieve() Importer.from_string(content).apply() > return func(*args, **kwargs) .../blueprints/tests/__init__.py:25: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> @retry() @apply_blueprint( "default/flow-default-authentication-flow.yaml", "default/flow-default-invalidation-flow.yaml", ) @apply_blueprint( "default/flow-default-source-authentication.yaml", "default/flow-default-source-enrollment.yaml", "default/flow-default-source-pre-authentication.yaml", ) def test_oauth_link(self): """test OAuth Source link OIDC""" self.create_objects() self.driver.get(self.live_server_url) self.login() self.driver.get( self.url("authentik_sources_oauth:oauth-client-login", source_slug=self.slug) ) # Now we should be at the IDP, wait for the login field self.wait.until(ec.presence_of_element_located((By.ID, "login"))) self.driver.find_element(By.ID, "login").send_keys("[email protected]") self.driver.find_element(By.ID, "password").send_keys("password") self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER) # Wait until we're logged in self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "button[type=submit]"))) self.driver.find_element(By.CSS_SELECTOR, "button[type=submit]").click() self.driver.get(self.url("authentik_api:usersourceconnection-list") + "?format=json") body_json = loads(self.driver.find_element(By.CSS_SELECTOR, "pre").text) results = body_json["results"] > self.assertEqual(len(results), 1) tests/e2e/test_source_oauth_oauth2.py:230: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> first = 0, second = 1, msg = None def assertEqual(self, first, second, msg=None): """Fail if the two objects are unequal as determined by the '==' operator. """ assertion_func = self._getAssertEqualityFunc(first, second) > assertion_func(first, second, msg=msg) .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:885: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <tests.e2e.test_source_oauth_oauth2.TestSourceOAuth2 testMethod=test_oauth_link> first = 0, second = 1, msg = '0 != 1' def _baseAssertEqual(self, first, second, msg=None): """The default assertEqual implementation, not type specific.""" if not first == second: standardMsg = '%s != %s' % _common_shorten_repr(first, second) msg = self._formatMessage(msg, standardMsg) > raise self.failureException(msg) E AssertionError: 0 != 1 .../hostedtoolcache/Python/3.12.6.............../x64/lib/python3.12/unittest/case.py:878: AssertionError
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard