Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Example backend
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas SAUVAGE
Example backend
Commits
84ba8be7
Verified
Commit
84ba8be7
authored
1 year ago
by
Thomas SAUVAGE
Browse files
Options
Downloads
Patches
Plain Diff
Will use only one DB
parent
20f38688
No related branches found
Branches containing commit
No related tags found
1 merge request
!4
Trying to implement openid
Pipeline
#13833
failed
1 year ago
Stage: Code quality
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Controllers/auth/authSigmaUser.ts
+4
-2
4 additions, 2 deletions
app/Controllers/auth/authSigmaUser.ts
with
4 additions
and
2 deletions
app/Controllers/auth/authSigmaUser.ts
+
4
−
2
View file @
84ba8be7
import
Env
from
'
@ioc:Adonis/Core/Env
'
import
Env
from
'
@ioc:Adonis/Core/Env
'
import
{
HttpContextContract
}
from
'
@ioc:Adonis/Core/HttpContext
'
import
{
HttpContextContract
}
from
'
@ioc:Adonis/Core/HttpContext
'
import
NotSigmaUser
from
'
App/Models/NotSigmaUser
'
import
{
ClientMetadata
,
Issuer
,
generators
}
from
'
openid-client
'
import
{
ClientMetadata
,
Issuer
,
generators
}
from
'
openid-client
'
const
AUTH_URL
=
'
https://auth.binets.fr
'
const
AUTH_URL
=
'
https://auth.binets.fr
'
...
@@ -60,11 +61,12 @@ export const callbackSigmaUser = async ({ response, request, auth }: HttpContext
...
@@ -60,11 +61,12 @@ export const callbackSigmaUser = async ({ response, request, auth }: HttpContext
if
(
!
username
||
!
name
||
!
groups
)
if
(
!
username
||
!
name
||
!
groups
)
throw
new
Error
(
'
The user given by the auth server is incomplete
'
)
throw
new
Error
(
'
The user given by the auth server is incomplete
'
)
const
user
=
{
const
user
=
await
NotSigmaUser
.
firstOrCreate
(
{
username
,
// Unique ?
username
,
// Unique ?
name
,
name
,
groups
:
groups
as
string
[],
// ! UGLY
groups
:
groups
as
string
[],
// ! UGLY
}
}
)
const
token
=
await
auth
.
use
(
'
api
'
).
login
(
user
)
return
response
.
ok
(
'
Ok!
'
)
return
response
.
ok
(
'
Ok!
'
)
}
}
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