示例#1
0
        public IHttpActionResult Logout()
        {
            logger.Start("[AuthenticationController.Logout] called");

            var ctx = Request.GetOwinContext();

            ctx.Authentication.SignOut(
                Constants.PrimaryAuthenticationType,
                Constants.ExternalAuthenticationType,
                Constants.PartialSignInAuthenticationType);

            ClearLoginRequestMessage();

            var baseUrl = Request.GetBaseUrl(settings.GetPublicHost());
            var urls    = new List <string>();

            foreach (var url in this.internalConfiguration.PluginDependencies.SignOutCallbackUrls)
            {
                var tmp = url;
                if (tmp.StartsWith("/"))
                {
                    tmp = tmp.Substring(1);
                }
                urls.Add(baseUrl + tmp);
            }

            return(new EmbeddedHtmlResult(Request,
                                          new LayoutModel
            {
                Server = settings.GetSiteName(),
                Page = "logout",
                PageModel = new
                {
                    signOutUrls = urls.ToArray()
                }
            }));
        }
示例#2
0
        public IHttpActionResult Logout()
        {
            logger.Start("[LogoutController.Logout] called");

            return(new EmbeddedHtmlResult(
                       Request,
                       new LayoutModel
            {
                Server = settings.GetSiteName(),
                Page = "logoutprompt",
                PageModel = new
                {
                    url = Url.Route(Constants.RouteNames.Logout, null)
                }
            }));
        }
        private SecurityTokenServiceDescriptor GetTokenServiceDescriptor(string wsfedEndpoint)
        {
            var tokenService = new SecurityTokenServiceDescriptor();

            tokenService.ServiceDescription = _settings.GetSiteName();
            tokenService.Keys.Add(GetSigningKeyDescriptor());

            tokenService.PassiveRequestorEndpoints.Add(new EndpointReference(wsfedEndpoint));
            tokenService.SecurityTokenServiceEndpoints.Add(new EndpointReference(wsfedEndpoint));

            tokenService.TokenTypesOffered.Add(new Uri(TokenTypes.OasisWssSaml11TokenProfile11));
            tokenService.TokenTypesOffered.Add(new Uri(TokenTypes.OasisWssSaml2TokenProfile11));
            tokenService.TokenTypesOffered.Add(new Uri(TokenTypes.JsonWebToken));

            tokenService.ProtocolsSupported.Add(new Uri("http://docs.oasis-open.org/wsfed/federation/200706"));

            return(tokenService);
        }
示例#4
0
        private IHttpActionResult CreateConsentResult(
            ValidatedAuthorizeRequest validatedRequest,
            NameValueCollection requestParameters,
            string errorMessage)
        {
            var    consentModel = new ConsentModel(validatedRequest, requestParameters);
            string name         = User.GetName();

            return(new EmbeddedHtmlResult(
                       Request,
                       new LayoutModel
            {
                Server = _settings.GetSiteName(),
                ErrorMessage = errorMessage,
                Page = "consent",
                Username = name,
                SwitchUrl = Url.Route("switch", null) + "?" + requestParameters.ToQueryString(),
                PageModel = consentModel
            }));
        }