私たちは、apiドキュメントのためにswagger/swashbuckleを使用するasp.net web apiアプリケーションを持っています。 apiは、oauth/openid-connectを使用してazure ADによって保護されています。闊歩ための設定は、コードで行われます。Web API swagger/swashbuckle UI用のauth urlにopenidスコープを追加
var oauthParams = new Dictionary<string, string>
{
{ "resource", "https://blahblahblah/someId" }
};
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
c.SingleApiVersion(Version, Name);
c.UseFullTypeNameInSchemaIds();
c.OAuth2("oauth2")
.Description("OAuth2 Implicit Grant")
.Flow("implicit")
.AuthorizationUrl(
"https://login.microsoftonline.com/te/ourtenant/ourcustompolicy/oauth2/authorize")
.TokenUrl(
"https://login.microsoftonline.com/te/ourtenant/ourcustompolicy/oauth2/token");
c.OperationFilter<AssignOAuth2SecurityRequirements>();
})
.EnableSwaggerUi(c =>
{
c.EnableOAuth2Support(_applicationId, null, "http://localhost:49919/swagger/ui/o2c-html", "Swagger", " ", oauthParams);
c.BooleanValues(new[] { "0", "1" });
c.DisableValidator();
c.DocExpansion(DocExpansion.List);
});
swashbuckleは、ログインのための認証URLを作成すると、それが自動的に追加されます。 &範囲=
をしかし、私はあることを、これを必要があります。 &範囲=
var oauthParams = new Dictionary<string, string>
{
{ "resource", "https://blahblahblah/someId" },
{ "scope", "openid" }
};
:OpenIDを
私はこの追加しようとしています
しかし、この後、追加されています。
&scope=&someotherparam=someothervalue&scope=openid
任意のアイデアを構築しswashbuckle認証URLに
&scope=openid
を追加する方法?
https://github.com/swagger-api/swagger-ui/blob/2.x/dist/lib/swagger-oauth.js
これらのjsファイルは、古いバージョンを参照するgitのサブモジュールから、次のとおりです。
感謝