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

remove mentions of tunnistamo sso #542

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,9 @@
VITE_API_URL=https://mvj.dev.hel.ninja/v1
VITE_STORAGE_PREFIX=MVJ
PORT=3000
# Helsinki Tunnistamo (legacy)
VITE_OPENID_CONNECT_API_TOKEN_KEY=https://api.hel.fi/auth/mvj
VITE_OPENID_CONNECT_API_TOKEN_URL=https://api.hel.fi/sso/api-tokens/
VITE_OPENID_CONNECT_AUTHORITY_URL=https://api.hel.fi/sso/openid/
VITE_OPENID_CONNECT_CLIENT_ID=https://api.hel.fi/auth/mvj
VITE_OPENID_CONNECT_SCOPE=openid profile mvj https://api.hel.fi/auth/mvj
# Helsinki Tunnistus
VITE_TUNNISTUS_OIDC_CLIENT_ID=mvj-admin-ui-dev
VITE_TUNNISTUS_OIDC_AUTHORITY_URL=https://tunnistus.test.hel.ninja/auth/realms/helsinki-tunnistus
VITE_TUNNISTUS_OIDC_SCOPE=openid profile
VITE_TUNNISTUS_OIDC_API_AUDIENCE=mvj-api-dev
VITE_TUNNISTUS_OIDC_API_TOKEN_URL=https://tunnistus.test.hel.ninja/auth/realms/helsinki-tunnistus/protocol/openid-connect/token
# Use legacy Tunnistamo SSO, or Tunnistus SSO?
# Options: "tunnistamo", "tunnistus"
VITE_OIDC_PROVIDER=tunnistamo
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ You can log into the container to execute some commands like so:
docker exec -it mvj-ui bash
```

If you want to set up full integration with mvj backend and tunnistamo, check
[here](https://github.com/City-of-Helsinki/mvj#connecting-to-tunnistamo)
for the guidance.

## Usage w/o Docker


Expand Down
21 changes: 2 additions & 19 deletions src/auth/constants.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
import type { LoginProviderProps } from 'hds-react';

type OidcProviderName = 'tunnistamo' | 'tunnistus';

// Tunnistamo SSO (legacy)
const loginProviderTunnistamoProperties: LoginProviderProps = {
userManagerSettings: {
authority: import.meta.env.VITE_OPENID_CONNECT_AUTHORITY_URL || 'https://api.hel.fi/sso/openid/',
client_id: import.meta.env.VITE_OPENID_CONNECT_CLIENT_ID || '',
scope: import.meta.env.VITE_OPENID_CONNECT_SCOPE || 'openid profile https://api.hel.fi/auth/mvj',
redirect_uri: `${location.origin}/callback`,
},
apiTokensClientSettings: { url: import.meta.env.VITE_OPENID_CONNECT_API_TOKEN_URL },
sessionPollerSettings: { pollIntervalInMs: 300000 } // 300000ms = 5min
};

// Tunnistus SSO
const loginProviderTunnistusProperties: LoginProviderProps = {
userManagerSettings: {
Expand All @@ -33,9 +19,6 @@ const loginProviderTunnistusProperties: LoginProviderProps = {
sessionPollerSettings: { pollIntervalInMs: 300000 } // 300000ms = 5min
};

export const oidcProviderName: OidcProviderName = import.meta.env.VITE_OIDC_PROVIDER || 'tunnistus';
// By default use Tunnistus SSO
export const loginProviderProperties = oidcProviderName === 'tunnistamo' ? loginProviderTunnistamoProperties : loginProviderTunnistusProperties;
const tunnistamoApiTokenKeyName: string = import.meta.env.VITE_OPENID_CONNECT_API_TOKEN_KEY || 'https://api.hel.fi/auth/mvj';
export const loginProviderProperties = loginProviderTunnistusProperties;
const tunnistusApiTokenKeyName: string = import.meta.env.VITE_TUNNISTUS_OIDC_API_AUDIENCE || 'mvj-api';
export const apiTokenKeyName = oidcProviderName === 'tunnistamo' ? tunnistamoApiTokenKeyName : tunnistusApiTokenKeyName;
export const apiTokenKeyName = tunnistusApiTokenKeyName;