示例#1
0
        public string WsFederationMetadata()
        {
            var config = new DevStsTokenServiceConfiguration();
            var uri    = new Uri(Request.Url.AbsoluteUri).GetLeftPart(UriPartial.Authority);
            var claims = UserManager.GetAllUniqueClaimTypes();

            return(config.GetFederationMetadata(uri, claims).ToString(SaveOptions.DisableFormatting));
        }
示例#2
0
        private ActionResult ProcessSignIn(SignInRequestMessage signInMsg, ClaimsPrincipal user)
        {
            var config = new DevStsTokenServiceConfiguration();
            var sts    = config.CreateSecurityTokenService();

            // when the reply querystringparameter has been specified, don't overrule it.
            if (string.IsNullOrEmpty(signInMsg.Reply))
            {
                var appPath = Request.ApplicationPath;
                if (appPath != null && !appPath.EndsWith("/"))
                {
                    appPath += "/";
                }

                signInMsg.Reply = new Uri(Request.Url, appPath).AbsoluteUri;
            }
            var response = FederatedPassiveSecurityTokenServiceOperations.ProcessSignInRequest(signInMsg, user, sts);

            var body = response.WriteFormPost();

            return(Html(body));
        }