Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
leximpact-socio-fiscal-ui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
leximpact-socio-fiscal-ui
Commits
4934b990
Commit
4934b990
authored
2 years ago
by
Emmanuel Raviart
Browse files
Options
Downloads
Patches
Plain Diff
Move session to root layout data.
parent
9801c1f6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app.d.ts
+1
-44
1 addition, 44 deletions
src/app.d.ts
src/lib/server/oauth2.ts
+2
-1
2 additions, 1 deletion
src/lib/server/oauth2.ts
src/routes/+layout.server.ts
+30
-1
30 additions, 1 deletion
src/routes/+layout.server.ts
with
33 additions
and
46 deletions
src/app.d.ts
+
1
−
44
View file @
4934b990
...
@@ -2,51 +2,8 @@
...
@@ -2,51 +2,8 @@
declare
namespace
App
{
declare
namespace
App
{
interface
Locals
{
interface
Locals
{
user
?:
User
user
?:
import
(
"
$lib/users
"
).
User
}
}
// interface Platform {}
// interface Platform {}
interface
Session
{
advanced
:
boolean
apiBaseUrls
:
string
[]
apiWebSocketBaseUrls
:
string
[]
baseUrl
:
string
authenticationEnabled
:
boolean
childrenKey
:
string
familyEntityKey
:
string
hasGithubPersonalAccessToken
:
boolean
hiddenEntitiesKeyPlural
?:
string
[]
householdEntityKey
:
string
legalUrl
:
string
matomo
?:
{
prependDomain
?:
boolean
siteId
:
number
subdomains
?:
string
url
:
string
}
openfiscaRepository
:
import
(
"
$lib/repositories
"
).
RepositoryConfig
portalUrl
:
string
reformName
?:
string
showTutorial
?:
boolean
taxableHouseholdEntityKey
:
string
territoiresUrl
:
string
title
:
string
user
?:
User
}
// interface Stuff {}
export
interface
User
{
email
:
string
// "john@doe.com"
email_verified
:
boolean
family_name
:
string
// "Doe"
given_name
:
string
// "John"
last_name
:
string
// "Doe"
locale
:
string
// "fr"
name
:
string
// "John Doe"
preferred_username
:
string
// "jdoe",
roles
?:
string
[]
// [ 'offline_access', 'default-roles-leximpact', 'uma_authorization' ],
sub
:
string
// "12345678-9abc-def0-1234-56789abcdef0"
}
}
}
This diff is collapsed.
Click to expand it.
src/lib/server/oauth2.ts
+
2
−
1
View file @
4934b990
...
@@ -2,8 +2,9 @@ import { SvelteKitAuth } from "sk-auth"
...
@@ -2,8 +2,9 @@ import { SvelteKitAuth } from "sk-auth"
import
{
OAuth2Provider
}
from
"
sk-auth/providers
"
import
{
OAuth2Provider
}
from
"
sk-auth/providers
"
import
config
from
"
$lib/server/config
"
import
config
from
"
$lib/server/config
"
import
type
{
User
}
from
"
$lib/users
"
type
Profile
=
App
.
User
type
Profile
=
User
interface
Tokens
{
interface
Tokens
{
access_token
:
string
access_token
:
string
...
...
This diff is collapsed.
Click to expand it.
src/routes/+layout.server.ts
+
30
−
1
View file @
4934b990
import
type
{
User
}
from
"
$lib/users
"
import
config
from
"
$lib/server/config
"
import
config
from
"
$lib/server/config
"
import
{
oauth2Authenticator
}
from
"
$lib/server/oauth2
"
import
{
oauth2Authenticator
}
from
"
$lib/server/oauth2
"
...
@@ -5,7 +6,35 @@ import type { LayoutServerLoad } from "./$types"
...
@@ -5,7 +6,35 @@ import type { LayoutServerLoad } from "./$types"
const
{
githubPersonalAccessToken
,
openfiscaRepository
}
=
config
const
{
githubPersonalAccessToken
,
openfiscaRepository
}
=
config
export
const
load
:
LayoutServerLoad
=
async
(
event
)
=>
{
export
const
load
:
LayoutServerLoad
=
async
(
event
,
):
Promise
<
{
advanced
:
boolean
apiBaseUrls
:
string
[]
apiWebSocketBaseUrls
:
string
[]
baseUrl
:
string
authenticationEnabled
:
boolean
childrenKey
:
string
familyEntityKey
:
string
hasGithubPersonalAccessToken
:
boolean
hiddenEntitiesKeyPlural
?:
string
[]
householdEntityKey
:
string
legalUrl
:
string
matomo
?:
{
prependDomain
?:
boolean
siteId
:
number
subdomains
?:
string
url
:
string
}
openfiscaRepository
:
import
(
"
$lib/repositories
"
).
RepositoryConfig
portalUrl
:
string
reformName
?:
string
showTutorial
?:
boolean
taxableHouseholdEntityKey
:
string
territoiresUrl
:
string
title
:
string
user
?:
User
}
>
=>
{
const
oauth2Session
=
await
oauth2Authenticator
?.
getSession
(
event
)
const
oauth2Session
=
await
oauth2Authenticator
?.
getSession
(
event
)
const
user
=
oauth2Session
?.
user
const
user
=
oauth2Session
?.
user
return
{
return
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment