File tree 1 file changed +42
-1
lines changed
1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,54 @@ export const SecurityScheme: React.FunctionComponent<SecuritySchemesProps> = (pr
13
13
case 'http' :
14
14
return < SecuritySchemeHttp { ...props . securityScheme } /> ;
15
15
case 'oauth2' :
16
+ return < SecuritySchemeOauth { ...props . securityScheme } /> ;
16
17
case 'openIdConnect' :
17
- throw new Error ( 'Unimplemented scheme' ) ;
18
+ return < SecuritySchemeOpenId { ... props . securityScheme } /> ;
18
19
default :
19
20
throw new Error ( `Unknown security scheme found: ${ JSON . stringify ( props . securityScheme ) } ` ) ;
20
21
}
21
22
} ;
22
23
24
+ const SecuritySchemeOpenId : React . FunctionComponent < OpenAPIV3 . OpenIdSecurityScheme > = ( openid ) => {
25
+ return (
26
+ < >
27
+ < span > OpenId Authentication, connect url: { openid . openIdConnectUrl } </ span >
28
+ < br />
29
+ { openid . description && (
30
+ < span >
31
+ < ReactMarkdown > { openid . description } </ ReactMarkdown >
32
+ </ span >
33
+ ) }
34
+ </ >
35
+ ) ;
36
+ } ;
37
+
38
+ const SecuritySchemeOauth : React . FunctionComponent < OpenAPIV3 . OAuth2SecurityScheme > = ( oauth ) => {
39
+ return (
40
+ < >
41
+ < span > OAuth2</ span >
42
+ { oauth . flows && Object . keys ( oauth . flows ) . length > 0 && (
43
+ < >
44
+ < span > Supported flows</ span >
45
+ < br />
46
+ < ul >
47
+ { oauth . flows . authorizationCode && < li > Authorization code</ li > }
48
+ { oauth . flows . clientCredentials && < li > Client credentials</ li > }
49
+ { oauth . flows . implicit && < li > Implicit</ li > }
50
+ { oauth . flows . password && < li > Password</ li > }
51
+ </ ul >
52
+ </ >
53
+ ) }
54
+ < br />
55
+ { oauth . description && (
56
+ < span >
57
+ < ReactMarkdown > { oauth . description } </ ReactMarkdown >
58
+ </ span >
59
+ ) }
60
+ </ >
61
+ ) ;
62
+ } ;
63
+
23
64
const SecuritySchemeHttp : React . FunctionComponent < OpenAPIV3 . HttpSecurityScheme > = ( http ) => {
24
65
return (
25
66
< >
You can’t perform that action at this time.
0 commit comments