Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Acknowledgement ##

* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v3.44.0](https://github.com/swagger-api/swagger-ui/releases/tag/v3.44.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v5.29.0](https://github.com/swagger-api/swagger-ui/releases/tag/v5.29.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
* This extension supports the OpenAPI spec version of [v2.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) and [v3.0.1](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md).


Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This enables Azure Functions to render OpenAPI document and Swagger UI. The more

## Acknowledgement ##

* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v3.44.0](https://github.com/swagger-api/swagger-ui/releases/tag/v3.44.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v5.29.0](https://github.com/swagger-api/swagger-ui/releases/tag/v5.29.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).


## Issues? ##
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-in-proc.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please find this document, [Microsoft.Azure.Functions.Worker.Extensions.OpenApi]

## Acknowledgement ##

* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v3.44.0](https://github.com/swagger-api/swagger-ui/releases/tag/v3.44.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v5.29.0](https://github.com/swagger-api/swagger-ui/releases/tag/v5.29.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).


## Issues? ##
Expand Down
2 changes: 1 addition & 1 deletion docs/openapi-out-of-proc.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This enables Azure Functions to render OpenAPI document and Swagger UI. Unlike t

## Acknowledgement ##

* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v3.44.0](https://github.com/swagger-api/swagger-ui/releases/tag/v3.44.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).
* [Swagger UI](https://github.com/swagger-api/swagger-ui) version used for this library is [v5.29.0](https://github.com/swagger-api/swagger-ui/releases/tag/v5.29.0) under the [Apache 2.0 license](https://opensource.org/licenses/Apache-2.0).


## Issues? ##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,70 +6,53 @@
<body>
<script>
'use strict';
function run () {
var oauth2 = window.opener.swaggerUIRedirectOauth2;
var sentState = oauth2.state;
var redirectUrl = oauth2.redirectUrl;
var isValid, qp, arr;

if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
} else {
qp = location.search.substring(1);
}

arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value);
}
) : {};

isValid = qp.state === sentState;

if ((
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
});
}

if (qp.code) {
delete oauth2.state;
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}

oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
}
window.close();
}

window.addEventListener('DOMContentLoaded', function () {
run();
function run() {
var e, r, t, a = window.opener.swaggerUIRedirectOauth2, o = a.state, n = a.redirectUrl;
if ((t = (r = /code|token|error/.test(window.location.hash) ? window.location.hash.substring(1).replace("?", "&") : location.search.substring(1)).split("&")).forEach((function(e, r, t) {
t[r] = '"' + e.replace("=", '":"') + '"'
}
)),
e = (r = r ? JSON.parse("{" + t.join() + "}", (function(e, r) {
return "" === e ? r : decodeURIComponent(r)
}
)) : {}).state === o,
"accessCode" !== a.auth.schema.get("flow") && "authorizationCode" !== a.auth.schema.get("flow") && "authorization_code" !== a.auth.schema.get("flow") || a.auth.code)
a.callback({
auth: a.auth,
token: r,
isValid: e,
redirectUrl: n
});
else if (e || a.errCb({
authId: a.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
}),
r.code)
delete a.state,
a.auth.code = r.code,
a.callback({
auth: a.auth,
redirectUrl: n
});
else {
let e;
r.error && (e = "[" + r.error + "]: " + (r.error_description ? r.error_description + ". " : "no accessCode received from the server. ") + (r.error_uri ? "More info: " + r.error_uri : "")),
a.errCb({
authId: a.auth.name,
source: "auth",
level: "error",
message: e || "[Authorization failed]: no accessCode received from the server"
})
}
window.close()
}
"loading" !== document.readyState ? run() : document.addEventListener("DOMContentLoaded", (function() {
run()
}
));

</script>
</body>
</html>

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
Expand All @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.6.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading