Skip to content
Open
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
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ VITE_IDENTITY_PROVIDER=
VITE_OIDC_ISSUER=
VITE_OIDC_ENABLED=false
VITE_OIDC_CLIENT_ID=

# oidc scopes used to retrieve roles and other jwt attribute (e.g. "profile,roles")
VITE_OIDC_SCOPES=profile,roles
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- Authentication:
- retrive scopes for jwt token
- new env variable: `VITE_OIDC_SCOPES` (default value `"profile,roles"`)

## [1.0.2](https://github.com/InseeFr/walking-papers/releases/tag/1.0.2) - 2026-03-03

### Added
Expand Down
5 changes: 5 additions & 0 deletions src/libs/i18n/auth/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const decodedIdTokenSchema = z.object({
preferred_username: z.string(),
})

const oidcScopes = (import.meta.env.VITE_OIDC_SCOPES || 'profile,roles').split(
',',
)

export const { OidcProvider, useOidc, getOidc } =
import.meta.env.VITE_OIDC_ENABLED === 'false'
? createMockReactOidc({
Expand All @@ -25,5 +29,6 @@ export const { OidcProvider, useOidc, getOidc } =
clientId: import.meta.env.VITE_OIDC_CLIENT_ID,
issuerUri: import.meta.env.VITE_OIDC_ISSUER,
homeUrl: import.meta.env.BASE_URL,
scopes: oidcScopes,
decodedIdTokenSchema,
})
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ type ImportMetaEnv = {
VITE_OIDC_ISSUER: string
VITE_OIDC_ENABLED: string
VITE_OIDC_CLIENT_ID: string
VITE_OIDC_SCOPES: string
BASE_URL: string
MODE: string
DEV: boolean
Expand Down
Loading