Bugzilla – Attachment 41908 Details for
Bug 14458
Add SwaggerUI documentation for RESTful API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14458: (follow-up) Add checkbox to optionally disable Authorization-header
Bug-14458-follow-up-Add-checkbox-to-optionally-dis.patch (text/plain), 2.66 KB, created by
Lari Taskula
on 2015-08-25 12:02:09 UTC
(
hide
)
Description:
Bug 14458: (follow-up) Add checkbox to optionally disable Authorization-header
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2015-08-25 12:02:09 UTC
Size:
2.66 KB
patch
obsolete
>From bf5b099e2681bc9f3bccf50fee38b9e71bc0b3c8 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Tue, 25 Aug 2015 11:58:47 +0000 >Subject: [PATCH] Bug 14458: (follow-up) Add checkbox to optionally disable > Authorization-header > >In case you want to test in SwaggerUI without sending the Authorization-header, >there is now a checkbox to optionally disable it. >--- > api/v1/doc/index.html | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/api/v1/doc/index.html b/api/v1/doc/index.html >index d645565..3c62c2e 100644 >--- a/api/v1/doc/index.html >+++ b/api/v1/doc/index.html >@@ -79,6 +79,7 @@ > }); > > $('#input_apiKey').change(addApiKeyAuthorization); >+ $("#useAuthorizationHeader").click(addApiKeyAuthorization); > > // if you have an apiKey you would like to pre-populate on the page for demonstration purposes... > var apiUserid = "1"; >@@ -118,19 +119,26 @@ function createSubmitTriggersToInjectAuthorizationHeader() { > shaObj.setHMACKey(apikey, "TEXT"); > var message = httpVerb.toUpperCase() + " " + userid + " " + date; > shaObj.update(message); >- > var authorizationHeader = "Koha " + userid + ":" + shaObj.getHMAC("HEX"); > addApiKeyAuthorization(authorizationHeader); > addDateAuthorization(); > }); > } > function addApiKeyAuthorization(headerValue){ >+ if(!$("#useAuthorizationHeader").is(":checked")){ >+ window.swaggerUi.api.clientAuthorizations.remove("Authorization"); >+ return; >+ } > if(headerValue && headerValue.trim() != "") { > var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", headerValue, "header"); > window.swaggerUi.api.clientAuthorizations.add("Authorization", apiKeyAuth); > } > } > function addDateAuthorization(){ >+ if(!$("#useAuthorizationHeader").is(":checked")){ >+ window.swaggerUi.api.clientAuthorizations.remove("X-Koha-Date"); >+ return; >+ } > var key = $('#dateHeaderInput')[0].value; > if(key && key.trim() != "") { > var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("X-Koha-Date", key, "header"); >@@ -160,6 +168,10 @@ function addDateAuthorization(){ > <td colspan="2"><h3>Authorization-header</h3></td> > </tr> > <tr> >+ <td><label for="useAuthorizationHeader">Use Authorization-header:</label></td> >+ <td><input type="checkbox" id="useAuthorizationHeader" name="useAuthorizationHeader" checked="checked" /> >+ </tr> >+ <tr> > <td><label for="input_apiUserid">Userid:</label></td> > <td><input placeholder="api_userid" id="input_apiUserid" name="apiUserid" type="text" style="width:100%"/></td> > </tr> >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14458
:
40614
|
40615
|
41167
|
41309
|
41332
|
41544
| 41908 |
42327