diff --git a/source/Core/Extensions/InternalOwinExtensions.cs b/source/Core/Extensions/InternalOwinExtensions.cs index cadeae015..b3849719e 100644 --- a/source/Core/Extensions/InternalOwinExtensions.cs +++ b/source/Core/Extensions/InternalOwinExtensions.cs @@ -264,6 +264,22 @@ public static string GetIdentityServerBaseUrl(this IOwinContext context) return context.Environment.GetIdentityServerBaseUrl(); } + public static string GetIdentityServerIssuerUri(this IOwinContext context) + { + if (context == null) throw new ArgumentNullException("context"); + + var options = context.ResolveDependency(); + + var uri = options.IssuerUri; + if (String.IsNullOrWhiteSpace(uri)) + { + uri = context.GetIdentityServerBaseUrl(); + if (uri.EndsWith("/")) uri = uri.Substring(0, uri.Length - 1); + } + + return uri; + } + public static string GetIdentityServerLogoutUrl(this IOwinContext context) { if (context == null) throw new ArgumentNullException("context");