Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6eae627

Browse files
committed
Add OIDC to the frontend
1 parenta49b491 commit6eae627

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

‎site/src/components/SignInForm/SignInForm.stories.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,26 @@ WithGithub.args = {
9999
authMethods:{
100100
password:true,
101101
github:true,
102+
oidc:false,
103+
},
104+
}
105+
106+
exportconstWithOIDC=Template.bind({})
107+
WithOIDC.args={
108+
...SignedOut.args,
109+
authMethods:{
110+
password:true,
111+
github:false,
112+
oidc:true,
113+
},
114+
}
115+
116+
exportconstWithGithubAndOIDC=Template.bind({})
117+
WithGithubAndOIDC.args={
118+
...SignedOut.args,
119+
authMethods:{
120+
password:true,
121+
github:true,
122+
oidc:true,
102123
},
103124
}

‎site/src/components/SignInForm/SignInForm.tsx

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
importBoxfrom"@material-ui/core/Box"
12
importButtonfrom"@material-ui/core/Button"
23
importLinkfrom"@material-ui/core/Link"
34
import{makeStyles}from"@material-ui/core/styles"
45
importTextFieldfrom"@material-ui/core/TextField"
56
importGitHubIconfrom"@material-ui/icons/GitHub"
7+
importKeyIconfrom"@material-ui/icons/VpnKey"
68
import{ErrorSummary}from"components/ErrorSummary/ErrorSummary"
79
import{Stack}from"components/Stack/Stack"
810
import{FormikContextType,FormikTouched,useFormik}from"formik"
@@ -43,6 +45,7 @@ export const Language = {
4345
},
4446
passwordSignIn:"Sign In",
4547
githubSignIn:"GitHub",
48+
oidcSignIn:"OpenID Connect",
4649
}
4750

4851
constvalidationSchema=Yup.object({
@@ -155,32 +158,51 @@ export const SignInForm: FC<SignInFormProps> = ({
155158
</div>
156159
</Stack>
157160
</form>
158-
{authMethods?.github&&(
161+
{(authMethods?.github||authMethods?.oidc)&&(
159162
<>
160163
<divclassName={styles.divider}>
161164
<divclassName={styles.dividerLine}/>
162165
<divclassName={styles.dividerLabel}>Or</div>
163166
<divclassName={styles.dividerLine}/>
164167
</div>
165168

166-
<div>
167-
<Link
168-
underline="none"
169-
href={`/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent(
170-
redirectTo,
171-
)}`}
172-
>
173-
<Button
174-
startIcon={<GitHubIconclassName={styles.buttonIcon}/>}
175-
disabled={isLoading}
176-
fullWidth
177-
type="submit"
178-
variant="contained"
169+
<Boxdisplay="grid"gridGap="16px">
170+
{authMethods.github&&(
171+
<Link
172+
underline="none"
173+
href={`/api/v2/users/oauth2/github/callback?redirect=${encodeURIComponent(
174+
redirectTo,
175+
)}`}
179176
>
180-
{Language.githubSignIn}
181-
</Button>
182-
</Link>
183-
</div>
177+
<Button
178+
startIcon={<GitHubIconclassName={styles.buttonIcon}/>}
179+
disabled={isLoading}
180+
fullWidth
181+
type="submit"
182+
variant="contained"
183+
>
184+
{Language.githubSignIn}
185+
</Button>
186+
</Link>
187+
)}
188+
189+
{authMethods.oidc&&(
190+
<Link
191+
underline="none"
192+
href={`/api/v2/users/oidc/callback?redirect=${encodeURIComponent(redirectTo)}`}
193+
>
194+
<Button
195+
startIcon={<KeyIconclassName={styles.buttonIcon}/>}
196+
disabled={isLoading}
197+
fullWidth
198+
type="submit"
199+
variant="contained"
200+
>
201+
{Language.oidcSignIn}
202+
</Button>
203+
</Link>
204+
)}
205+
</Box>
184206
</>
185207
)}
186208
</>

‎site/src/testHelpers/entities.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ export const MockUserAgent: Types.UserAgent = {
304304
exportconstMockAuthMethods:TypesGen.AuthMethods={
305305
password:true,
306306
github:false,
307+
oidc:false,
307308
}
308309

309310
exportconstMockGitSSHKey:TypesGen.GitSSHKey={

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp