16
16
< script type ="module " src ="../rapidoc-min.js "> </ script >
17
17
< link href ="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;600&family=Roboto+Mono&display=swap " rel ="stylesheet ">
18
18
< style >
19
- .size { width : 80 px ; height : 30px ; font-size : 13px ; margin : 0 2px ; padding : 0 8px ; border-radius : 2px ; outline : none; color : # fff ;}
19
+ .size { width : 100 px ; height : 30px ; font-size : 13px ; margin : 0 2px ; padding : 0 8px ; border-radius : 2px ; outline : none; color : # fff ;}
20
20
.btn { background-color : # 2069e0 ; cursor : pointer; border : 1px solid transparent;}
21
21
.txt {background-color : # 2e2e2e ; border : 1px solid # 2069e0 ;}
22
22
.table { border : 1px solid # 444 ; border-collapse : collapse;}
23
23
.table td { font-size : 12px ; font-family : 'Roboto Mono' ; border : 1px solid # 444 ; padding : 8px ;}
24
+ .table th { font-size : 11px ; font-family : 'Open Sans' ; border : 1px solid # 444 ; padding : 8px ; background : # 222 ;}
25
+ datalist {
26
+ background-color : # 222 ;
27
+ border : 1px solid # 2069e0 ;
28
+ }
24
29
rapi-doc {
25
30
width : 100% ;
26
31
}
@@ -41,29 +46,30 @@ <h3>Programmatically Applying Security and Setting a API Server</h3>
41
46
*This section is not RapiDoc generated. It is user injected HTML/JS into a < span style ="font-family:'Roboto Mono' "> <slot></ span > element to demonstrate how to programatically apply security keys
42
47
</ div >
43
48
44
- < div style ="margin-top:16px ">
49
+ < div style ="margin:24px 0 8px 0 ">
45
50
RapiDoc provides you with two helper methods which you can use to supply security keys programatically.
46
- < ol >
47
- < li > < span style ="font-family:'Roboto Mono' "> setHttpUserNameAndPassword()</ span > </ li >
48
- < li > < span style ="font-family:'Roboto Mono' "> setApiKey()</ span > </ li >
49
- </ ol >
50
51
</ div >
51
- < p >
52
+ < table class ="table " style ="border:1px solid #444; font-family:'Roboto Mono' ">
53
+ < tr > < th > SCHEME-TYPE</ th > < th > METHOD USED TO UPDATE</ th > </ tr >
54
+ < tr > < td > basic</ td > < td > setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</ td > </ tr >
55
+ < tr > < td > other than basic</ td > < td style ="border-bottom: 1px dashed #383838; " rowspan ="3 "> setApiKey('api_key1', 'newApiToken')</ td > </ tr >
56
+ </ table >
57
+
58
+ < div style ="margin:24px 0 8px 0 ">
52
59
The table below list all the scurity schemes included in this spec. Check the corrosponding method that can be used to supply an access-token
53
- < table class ="table " style ="border:1px solid #444; font-family:'Roboto Mono' ">
54
- < tr > < th > TYPE</ th > < th > SECURITY SCHEME ID</ th > < th > METHOD USED TO UPDATE</ th > </ tr >
55
- < tr > < td > http</ td > < td > http-basic</ td > < td rowspan ="2 "> RapiDocEl.setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</ td > </ tr >
56
- < tr > < td > http</ td > < td > http-bearer</ td > </ tr >
57
- < tr > < td > oauth2</ td > < td > ms-oauth</ td > < td style ="border-bottom: 1px dashed #383838; " rowspan ="3 "> RapiDocEl.setApiKey('api_key1', 'newApiToken')</ td > </ tr >
58
- < tr > < td > apiKey</ td > < td > api_key1</ td > </ tr >
59
- < tr > < td > apiKey</ td > < td > api_key2</ td > </ tr >
60
- < tr > < td > apiKey</ td > < td > api_key_cookie</ td > < td >
61
- < span style ="font-family:'Open Sans'; color:#777 ">
62
- If the apiKey needs to send using a cookie, then it wont be set as RapiDoc do not support creation or reading of cookies
63
- </ span >
64
- </ td > </ tr >
65
- </ table >
66
- </ p >
60
+ </ div >
61
+ < table class ="table " style ="border:1px solid #444; font-family:'Roboto Mono' ">
62
+ < tr > < th > SECURITY SCHEME</ th > < th > SCHEME TYPE</ th > < th > METHOD USED TO UPDATE</ th > </ tr >
63
+ < tr > < td > http-basic</ td > < td > basic</ td > < td > setHttpUserNameAndPassword('http-basic', 'newUserName', 'newPassword')</ td > </ tr >
64
+ < tr > < td > http-bearer</ td > < td > bearer</ td > < td > setApiKey('http-bearer', 'newToken')</ td > </ tr >
65
+ < tr > < td > api_key1</ td > < td > < span style ="color:#777 "> (not-specified)</ span > </ td > < td > setApiKey('api_key1', 'newToken')</ td > </ tr >
66
+ < tr > < td > api_key2</ td > < td > < span style ="color:#777 "> (not-specified)</ span > </ td > < td > setApiKey('api_key2', 'newToken')</ td > </ tr >
67
+ < tr > < td > ms-oauth</ td > < td > < span style ="color:#777 "> (not-specified)</ span > </ td > < td > setApiKey('ms-oauth', 'newToken')</ td > </ tr >
68
+ < tr > < td > api_key_cookie</ td > < td > < span style ="color:#777 "> (not-specified)</ span > </ td >
69
+ < td > < span style ="color:#777 "> (wont work as this scheme sends api-key in a cookie, and rapidoc dont create/read cookies)</ span > </ td >
70
+ </ tr >
71
+ </ table >
72
+
67
73
< div style ="margin:32px 0 16px 0; color:#777; font-weight:bold ">
68
74
Below form is used for taking user input and apply the security key using javascipt
69
75
</ div >
@@ -79,20 +85,19 @@ <h3>Programmatically Applying Security and Setting a API Server</h3>
79
85
</ tr >
80
86
< tr >
81
87
< td > API Key</ td >
82
- < td >
83
- < input class ='size txt ' id ='api-security-scheme-id ' value ="api_key1 " type ='text ' placeholder ='Security Scheme ID ' spellcheck ='false ' style ="width:120px ">
88
+ < td >
89
+ < select class ='size txt ' style ="width:138px " id ='api-security-scheme-id ' placeholder ='Security Scheme ID '>
90
+ < option value ="api_key1 "> api_key1</ option >
91
+ < option value ="api_key2 "> api_key2</ option >
92
+ < option value ="http-bearer "> http-bearer</ option >
93
+ < option value ="ms-oauth "> ms-oauth</ option >
94
+ < option value ="invalid-key "> invalid-key</ option >
95
+ </ select >
96
+
84
97
< input class ='size txt ' id ='api-key-value ' type ='text ' value ="new-token " placeholder ='API Key Value ' spellcheck ='false ' >
85
98
< button class ='size btn ' onclick ='setSecurity(event, "apikey") '> Apply</ button >
86
99
</ td >
87
100
</ tr >
88
- < tr >
89
- < td > OAuth</ td >
90
- < td >
91
- < input class ='size txt ' id ='oauth-security-scheme-id ' value ="ms-oauth " type ='text ' placeholder ='Security Scheme ID ' spellcheck ='false ' style ="width:120px ">
92
- < input class ='size txt ' id ='oauth-key-value ' type ='text ' value ="new-token " placeholder ='Access Token ' spellcheck ='false ' >
93
- < button class ='size btn ' onclick ='setSecurity(event, "oauth2") '> Apply</ button >
94
- </ td >
95
- </ tr >
96
101
< tr >
97
102
< td colspan ="2 "> < button class ='size btn ' style ="width:200px " onclick ='clearSecurityKeys(event) '> Clear all Keys</ button > </ td >
98
103
</ tr >
@@ -110,8 +115,6 @@ <h3>Programmatically Applying Security and Setting a API Server</h3>
110
115
< td colspan ="2 "> < button class ='size btn ' style ="width:110px " onclick ='setApiServer(event) '> Set API Server</ button > </ td >
111
116
</ tr >
112
117
</ table >
113
-
114
-
115
118
</ div >
116
119
</ div >
117
120
</ rapi-doc >
0 commit comments