-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #373 from magento-api/MAGETWO-43020-Implement-Auth…
…orization-For-SOAP-And-REST-Schemas [API] WSDL Authentication
- Loading branch information
Showing
34 changed files
with
392 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/code/Magento/Swagger/view/frontend/web/swagger-ui/js/magento-swagger.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
$(function () { | ||
var url = $('#input_baseUrl').val(); | ||
|
||
// Pre load translate... | ||
if(window.SwaggerTranslator) { | ||
window.SwaggerTranslator.translate(); | ||
} | ||
window.swaggerUi = new SwaggerUi({ | ||
url: url, | ||
dom_id: "swagger-ui-container", | ||
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], | ||
onComplete: function(swaggerApi, swaggerUi){ | ||
if(typeof initOAuth == "function") { | ||
initOAuth({ | ||
clientId: "your-client-id", | ||
clientSecret: "your-client-secret", | ||
realm: "your-realms", | ||
appName: "your-app-name", | ||
scopeSeparator: "," | ||
}); | ||
} | ||
|
||
if(window.SwaggerTranslator) { | ||
window.SwaggerTranslator.translate(); | ||
} | ||
|
||
$('pre code').each(function(i, e) { | ||
hljs.highlightBlock(e) | ||
}); | ||
|
||
addApiKeyAuthorization(); | ||
}, | ||
onFailure: function(data) { | ||
log("Unable to Load SwaggerUI"); | ||
}, | ||
docExpansion: "none", | ||
apisSorter: "alpha", | ||
showRequestHeaders: false | ||
}); | ||
|
||
function addApiKeyAuthorization(){ | ||
var key = encodeURIComponent($('#input_apiKey')[0].value); | ||
if(key && key.trim() != "") { | ||
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("Authorization", "Bearer " + key, "header"); | ||
window.swaggerUi.api.clientAuthorizations.add("apiKeyAuth", apiKeyAuth); | ||
} | ||
} | ||
|
||
$('#input_apiKey').change(addApiKeyAuthorization); | ||
|
||
|
||
window.swaggerUi.load(); | ||
|
||
function log() { | ||
if ('console' in window) { | ||
console.log.apply(console, arguments); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.