Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
ec26a970
Unverified
Commit
ec26a970
authored
May 26, 2023
by
boojack
Committed by
GitHub
May 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: sso templates (#1753)
parent
dbe8aa1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
81 deletions
+82
-81
CreateIdentityProviderDialog.tsx
web/src/components/CreateIdentityProviderDialog.tsx
+82
-81
No files found.
web/src/components/CreateIdentityProviderDialog.tsx
View file @
ec26a970
...
@@ -8,99 +8,100 @@ import { generateDialog } from "./Dialog";
...
@@ -8,99 +8,100 @@ import { generateDialog } from "./Dialog";
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
import
{
useTranslation
}
from
"react-i18next"
;
import
{
useTranslation
}
from
"react-i18next"
;
interface
Props
extends
DialogProps
{
const
templateList
:
IdentityProvider
[]
=
[
identityProvider
?:
IdentityProvider
;
{
confirmCallback
?:
()
=>
void
;
id
:
UNKNOWN_ID
,
}
name
:
"GitHub"
,
type
:
"OAUTH2"
,
const
CreateIdentityProviderDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
identifierFilter
:
""
,
const
{
t
}
=
useTranslation
();
config
:
{
const
templateList
:
IdentityProvider
[]
=
[
oauth2Config
:
{
{
clientId
:
""
,
id
:
UNKNOWN_ID
,
clientSecret
:
""
,
name
:
"GitHub"
,
authUrl
:
"https://github.com/login/oauth/authorize"
,
type
:
"OAUTH2"
,
tokenUrl
:
"https://github.com/login/oauth/access_token"
,
identifierFilter
:
""
,
userInfoUrl
:
"https://api.github.com/user"
,
config
:
{
scopes
:
[
"user"
],
oauth2Config
:
{
fieldMapping
:
{
clientId
:
""
,
identifier
:
"login"
,
clientSecret
:
""
,
displayName
:
"name"
,
authUrl
:
"https://github.com/login/oauth/authorize"
,
email
:
"email"
,
tokenUrl
:
"https://github.com/login/oauth/access_token"
,
userInfoUrl
:
"https://api.github.com/user"
,
scopes
:
[
"user"
],
fieldMapping
:
{
identifier
:
t
(
"setting.sso-section.identifier"
),
displayName
:
""
,
email
:
""
,
},
},
},
},
},
},
},
{
},
id
:
UNKNOWN_ID
,
{
name
:
"GitLab"
,
id
:
UNKNOWN_ID
,
type
:
"OAUTH2
"
,
name
:
"GitLab
"
,
identifierFilter
:
"
"
,
type
:
"OAUTH2
"
,
config
:
{
identifierFilter
:
""
,
oauth2C
onfig
:
{
c
onfig
:
{
clientId
:
""
,
oauth2Config
:
{
clientSecret
:
""
,
clientId
:
""
,
authUrl
:
"https://gitlab.com/oauth/authorize
"
,
clientSecret
:
"
"
,
tokenUrl
:
"https://gitlab.com/oauth/token
"
,
authUrl
:
"https://gitlab.com/oauth/authorize
"
,
userInfoUrl
:
"https://gitlab.com/oauth/userinfo
"
,
tokenUrl
:
"https://gitlab.com/oauth/token
"
,
scopes
:
[
"openid"
]
,
userInfoUrl
:
"https://gitlab.com/oauth/userinfo"
,
fieldMapping
:
{
scopes
:
[
"openid"
],
identifier
:
t
(
"setting.sso-section.identifier"
),
fieldMapping
:
{
displayName
:
"
"
,
identifier
:
"name
"
,
email
:
"
"
,
displayName
:
"name
"
,
}
,
email
:
"email"
,
},
},
},
},
},
},
{
},
id
:
UNKNOWN_ID
,
{
name
:
"Google"
,
id
:
UNKNOWN_ID
,
type
:
"OAUTH2
"
,
name
:
"Google
"
,
identifierFilter
:
"
"
,
type
:
"OAUTH2
"
,
config
:
{
identifierFilter
:
""
,
oauth2C
onfig
:
{
c
onfig
:
{
clientId
:
""
,
oauth2Config
:
{
clientSecret
:
""
,
clientId
:
""
,
authUrl
:
"https://accounts.google.com/o/oauth2/v2/auth
"
,
clientSecret
:
"
"
,
tokenUrl
:
"https://oauth2.googleapis.com/token
"
,
authUrl
:
"https://accounts.google.com/o/oauth2/v2/auth
"
,
userInfoUrl
:
"https://www.googleapis.com/oauth2/v2/userinfo
"
,
tokenUrl
:
"https://oauth2.googleapis.com/token
"
,
scopes
:
[
"https://www.googleapis.com/auth/userinfo.email"
,
"https://www.googleapis.com/auth/userinfo.profile"
]
,
userInfoUrl
:
"https://www.googleapis.com/oauth2/v2/userinfo"
,
fieldMapping
:
{
scopes
:
[
"https://www.googleapis.com/auth/userinfo.email"
,
"https://www.googleapis.com/auth/userinfo.profile"
],
identifier
:
t
(
"setting.sso-section.identifier"
),
fieldMapping
:
{
displayName
:
"
"
,
identifier
:
"email
"
,
email
:
"
"
,
displayName
:
"name
"
,
}
,
email
:
"email"
,
},
},
},
},
},
},
{
},
id
:
UNKNOWN_ID
,
{
name
:
t
(
"setting.sso-section.custom"
)
,
id
:
UNKNOWN_ID
,
type
:
"OAUTH2
"
,
name
:
"Custom
"
,
identifierFilter
:
"
"
,
type
:
"OAUTH2
"
,
config
:
{
identifierFilter
:
""
,
oauth2C
onfig
:
{
c
onfig
:
{
clientId
:
""
,
oauth2Config
:
{
clientSecret
:
""
,
clientId
:
""
,
authUrl
:
""
,
clientSecret
:
""
,
token
Url
:
""
,
auth
Url
:
""
,
userInfo
Url
:
""
,
token
Url
:
""
,
scopes
:
[]
,
userInfoUrl
:
""
,
fieldMapping
:
{
scopes
:
[],
identifier
:
""
,
fieldMapping
:
{
displayName
:
""
,
identifier
:
""
,
email
:
""
,
displayName
:
""
,
}
,
email
:
""
,
},
},
},
},
},
},
];
},
];
interface
Props
extends
DialogProps
{
identityProvider
?:
IdentityProvider
;
confirmCallback
?:
()
=>
void
;
}
const
CreateIdentityProviderDialog
:
React
.
FC
<
Props
>
=
(
props
:
Props
)
=>
{
const
{
t
}
=
useTranslation
();
const
identityProviderTypes
=
[...
new
Set
(
templateList
.
map
((
t
)
=>
t
.
type
))];
const
identityProviderTypes
=
[...
new
Set
(
templateList
.
map
((
t
)
=>
t
.
type
))];
const
{
confirmCallback
,
destroy
,
identityProvider
}
=
props
;
const
{
confirmCallback
,
destroy
,
identityProvider
}
=
props
;
const
[
basicInfo
,
setBasicInfo
]
=
useState
({
const
[
basicInfo
,
setBasicInfo
]
=
useState
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment