-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(deps): install ueberauth_oidcc * feat: replace Cognito with Keycloak * feat: get group / role membership information from Keycloak * fix: update fake Ueberauth strategy * fixup! fix: update fake Ueberauth strategy * refactor: use verified routes in fake strategy * refactor: more verified routes * feat: remove old auth retry logic * feat: require membership in skate-readonly role * feat: enable toggling Keycloak / Cognito SSO with test group * fixup! feat: enable toggling Keycloak / Cognito SSO with test group
- Loading branch information
Showing
23 changed files
with
259 additions
and
45 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
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 |
---|---|---|
|
@@ -6,20 +6,29 @@ defmodule Skate.Ueberauth.Strategy.FakeTest do | |
|
||
@tag :authenticated | ||
test "credentials returns a credentials struct with groups specified in config", %{conn: conn} do | ||
assert conn |> get("/auth/cognito") |> Fake.credentials() == %Credentials{ | ||
assert conn |> get(~p"/auth/keycloak") |> Fake.credentials() == %Credentials{ | ||
token: "fake_access_token", | ||
refresh_token: "fake_refresh_token", | ||
expires: true, | ||
expires_at: System.system_time(:second) + 9 * 60 * 60, | ||
other: %{groups: ["skate-dispatcher", "skate-nav-beta"]} | ||
expires_at: System.system_time(:second) + 9 * 60 * 60 | ||
} | ||
end | ||
|
||
test "info returns an empty Info struct" do | ||
assert Fake.info(%{}) == %Info{email: "[email protected]"} | ||
end | ||
|
||
test "extra returns an Extra struct with empty raw_info" do | ||
assert Fake.extra(%{}) == %Extra{raw_info: %{}} | ||
test "extra returns an Extra struct with group membership information", %{conn: conn} do | ||
assert conn |> get(~p"/auth/keycloak") |> Fake.extra() == %Extra{ | ||
raw_info: %UeberauthOidcc.RawInfo{ | ||
userinfo: %{ | ||
"resource_access" => %{ | ||
"dev-client" => %{ | ||
"roles" => ["skate-dispatcher", "skate-nav-beta"] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
end | ||
end |
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 |
---|---|---|
|
@@ -2,6 +2,19 @@ defmodule SkateWeb.AuthManager.ErrorHandlerTest do | |
use SkateWeb.ConnCase | ||
|
||
describe "auth_error/3" do | ||
test "redirects to Keycloak login", %{conn: conn} do | ||
{:ok, test_group} = Skate.Settings.TestGroup.create("keycloak-sso") | ||
|
||
Skate.Settings.TestGroup.update(%{test_group | override: :enabled}) | ||
|
||
conn = | ||
conn | ||
|> init_test_session(%{username: "[email protected]"}) | ||
|> SkateWeb.AuthManager.ErrorHandler.auth_error({:some_type, :reason}, []) | ||
|
||
assert response(conn, :found) =~ ~p"/auth/keycloak" | ||
end | ||
|
||
test "redirects to Cognito login with two remaining retries", %{conn: conn} do | ||
conn = | ||
conn | ||
|
Oops, something went wrong.