private IHttpActionResult RenderLogoutPromptPage()
        {
            var logoutModel = new LogoutViewModel
            {
                SiteName    = options.SiteName,
                SiteUrl     = context.GetIdentityServerBaseUrl(),
                CurrentUser = context.GetCurrentUserDisplayName(),
                LogoutUrl   = context.GetIdentityServerLogoutUrl(),
                AntiForgery = antiForgeryToken.GetAntiForgeryToken(),
            };

            return(new LogoutActionResult(viewService, logoutModel));
        }
        private async Task <IHttpActionResult> RenderLogoutPromptPage(string id = null)
        {
            var clientName = await clientStore.GetClientName(signOutMessageCookie.Read(id));

            var logoutModel = new LogoutViewModel
            {
                SiteName    = options.SiteName,
                SiteUrl     = context.GetIdentityServerBaseUrl(),
                CurrentUser = User.Identity.Name,
                LogoutUrl   = Url.Route(Constants.RouteNames.Logout, new { id = id }),
                AntiForgery = antiForgeryToken.GetAntiForgeryToken(),
                ClientName  = clientName
            };

            return(new LogoutActionResult(viewService, logoutModel));
        }
Exemplo n.º 3
0
        private IHttpActionResult RenderLogoutPromptPage(string id)
        {
            var logout_url = context.GetIdentityServerLogoutUrl();

            if (id.IsPresent())
            {
                logout_url += "?id=" + id;
            }

            var logoutModel = new LogoutViewModel
            {
                SiteName    = options.SiteName,
                SiteUrl     = context.GetIdentityServerBaseUrl(),
                CurrentUser = context.GetCurrentUserDisplayName(),
                LogoutUrl   = logout_url,
                AntiForgery = antiForgeryToken.GetAntiForgeryToken(),
            };

            var message = signOutMessageCookie.Read(id);

            return(new LogoutActionResult(viewService, logoutModel, message));
        }
Exemplo n.º 4
0
        public Task <HttpResponseMessage> ExecuteAsync(System.Threading.CancellationToken cancellationToken)
        {
            var baseUrl = context.GetIdentityServerBaseUrl();

            var    assembly = Assembly.GetExecutingAssembly();
            var    fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string version  = fvi.FileVersion;

            var html    = AssetManager.LoadWelcomePage(baseUrl, version);
            var content = new StringContent(html, Encoding.UTF8, "text/html");

            var response = new HttpResponseMessage
            {
                Content = content
            };

            return(Task.FromResult(response));
        }
Exemplo n.º 5
0
        public static string GetIdentityServerIssuerUri(this IOwinContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var options = context.ResolveDependency <IdentityServerOptions>();

            var uri = options.IssuerUri;

            if (String.IsNullOrWhiteSpace(uri))
            {
                uri = context.GetIdentityServerBaseUrl();
                if (uri.EndsWith("/"))
                {
                    uri = uri.Substring(0, uri.Length - 1);
                }
            }

            return(uri);
        }
Exemplo n.º 6
0
        public static string GetIdentityServerIssuerUri(this IOwinContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            var options = context.ResolveDependency <IdentityServerOptions>();

            // if they've explicitly configured a URI then use it,
            // otherwise dynamically calculate it
            var uri = options.IssuerUri;

            if (uri.IsMissing())
            {
                uri = context.GetIdentityServerBaseUrl();
                if (uri.EndsWith("/"))
                {
                    uri = uri.Substring(0, uri.Length - 1);
                }
            }

            return(uri);
        }