当前位置: 首页>>代码示例>>C#>>正文


C# Models.SignInMessage类代码示例

本文整理汇总了C#中IdentityServer3.Core.Models.SignInMessage的典型用法代码示例。如果您正苦于以下问题:C# SignInMessage类的具体用法?C# SignInMessage怎么用?C# SignInMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SignInMessage类属于IdentityServer3.Core.Models命名空间,在下文中一共展示了SignInMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginActionResult

 public LoginActionResult(IViewService viewSvc, LoginViewModel model, SignInMessage message)
     : base(async () => await viewSvc.Login(model, message))
 {
     if (viewSvc == null) throw new ArgumentNullException("viewSvc");
     if (model == null) throw new ArgumentNullException("model");
     if (message == null) throw new ArgumentNullException("message");
 }
开发者ID:284247028,项目名称:IdentityServer3,代码行数:7,代码来源:LoginActionResult.cs

示例2: ValidateAsync

        public async Task<CustomGrantValidationResult> ValidateAsync(ValidatedTokenRequest request)
        {
            var legacyAccountStoreType = request.Raw.Get("account_store");
            var id = request.Raw.Get("legacy_id");
            var secret = request.Raw.Get("legacy_secret");

            if (string.IsNullOrWhiteSpace(legacyAccountStoreType) ||
                string.IsNullOrWhiteSpace(id) ||
                string.IsNullOrWhiteSpace(secret))
            {
                Logger.Error("malformed request");
                return null;
            }

            var message = new SignInMessage { Tenant = legacyAccountStoreType };
            var context = new LocalAuthenticationContext
            {
                UserName = id, Password = secret,
                SignInMessage = message
            };
            await _users.AuthenticateLocalAsync(context);

            var result = context.AuthenticateResult;
            if (result.IsError)
            {
                Logger.Error("authentication failed");
                return new CustomGrantValidationResult("Authentication failed.");
            }

            return new CustomGrantValidationResult(
                result.User.GetSubjectId(),
                "custom",
                result.User.Claims);
        }
开发者ID:camainc,项目名称:IdentityServer3.Samples,代码行数:34,代码来源:CustomGrantValidator.cs

示例3: Login

 /// <summary>
 /// Gets the currently running client app to put it's name in the login page
 /// </summary>
 /// <param name="model"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public async Task<Stream> Login(LoginViewModel model, SignInMessage message)
 {
     var client = await clientStore.FindClientByIdAsync(message.ClientId);
     var name = client != null ? client.ClientName : null;
     return await Render(model, "login", name);
     
 }
开发者ID:ianlovell,项目名称:openidconnect,代码行数:13,代码来源:CustomViewService.cs

示例4: AuthorizeInteractionResponseGenerator

 public AuthorizeInteractionResponseGenerator(IdentityServerOptions options, IConsentService consent, IUserService users, ILocalizationService localizationService)
 {
     _signIn = new SignInMessage();
     _options = options;
     _consent = consent;
     _users = users;
     _localizationService = localizationService;
 }
开发者ID:284247028,项目名称:IdentityServer3,代码行数:8,代码来源:AuthorizeInteractionResponseGenerator.cs

示例5: LoginResult

        public LoginResult(IDictionary<string, object> env, SignInMessage message)
        {
            if (env == null) throw new ArgumentNullException("env");
            if (message == null) throw new ArgumentNullException("message");

            this.env = env;
            this.message = message;
        }
开发者ID:Rolosoft,项目名称:IdentityServer3,代码行数:8,代码来源:LoginResult.cs

示例6: GetLoginPage

        private HttpResponseMessage GetLoginPage(SignInMessage msg = null)
        {
            msg = msg ?? new SignInMessage() { ReturnUrl = Url("authorize") };
            if (msg.ClientId == null) msg.ClientId = TestClients.Get().First().ClientId;

            SignInId = WriteMessageToCookie(msg);

            var resp = Get(Constants.RoutePaths.Login + "?signin=" + SignInId);
            ProcessXsrf(resp);
            return resp;
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:11,代码来源:AuthenticationControllerTests.cs

示例7: Login

        void Login(bool setCookie = true)
        {
            var msg = new SignInMessage() { ReturnUrl = Url("authorize") };
            var signInId = WriteMessageToCookie(msg);
            var url = Constants.RoutePaths.Login + "?signin=" + signInId;
            var resp = Get(url);
            ProcessXsrf(resp);

            if (setCookie)
            {
                resp = PostForm(url, new LoginCredentials { Username = "alice", Password = "alice" });
                client.SetCookies(resp.GetCookies());
            }
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:14,代码来源:AuthenticationControllerTests.cs

示例8: IsLocalLoginAllowedForClient

        async Task<bool> IsLocalLoginAllowedForClient(SignInMessage message)
        {
            if (message != null && message.ClientId.IsPresent())
            {
                var client = await clientStore.FindClientByIdAsync(message.ClientId);
                if (client != null)
                {
                    return client.EnableLocalLogin;
                }
            }

            return true;
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:13,代码来源:AuthenticationController.cs

示例9: GetRedirectUrl

        private Uri GetRedirectUrl(SignInMessage signInMessage, AuthenticateResult authResult)
        {
            if (signInMessage == null) throw new ArgumentNullException("signInMessage");
            if (authResult == null) throw new ArgumentNullException("authResult");

            if (authResult.IsPartialSignIn)
            {
                var path = authResult.PartialSignInRedirectPath;
                if (path.StartsWith("~/"))
                {
                    path = path.Substring(2);
                    path = Request.GetIdentityServerBaseUrl() + path;
                }
                var host = new Uri(context.GetIdentityServerHost());
                return new Uri(host, path);
            }
            else
            {
                return new Uri(signInMessage.ReturnUrl);
            }
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:21,代码来源:AuthenticationController.cs

示例10: Login

		public async Task<Stream> Login (LoginViewModel model, SignInMessage message)
		{
			return await Render (model, "Login");
		}
开发者ID:javagg,项目名称:idsvr3-mono,代码行数:4,代码来源:ViewService.cs

示例11: RedirectToLogin

        IHttpActionResult RedirectToLogin(SignInValidationResult result)
        {
            Uri publicRequestUri = GetPublicRequestUri();

            var message = new SignInMessage();
            message.ReturnUrl = publicRequestUri.ToString();

            if (!String.IsNullOrWhiteSpace(result.HomeRealm))
            {
                message.IdP = result.HomeRealm;
            }

            if (!String.IsNullOrWhiteSpace(result.Federation))
            {
                message.AcrValues = new[] { result.Federation };
            }
            
            var env = Request.GetOwinEnvironment();
            var url = env.CreateSignInRequest(message);
            
            return Redirect(url);
        }
开发者ID:mequanta,项目名称:Janitor-old,代码行数:22,代码来源:WsFederationController.cs

示例12: RaiseSuccessfulResourceOwnerAuthenticationEventAsync

 private async Task RaiseSuccessfulResourceOwnerAuthenticationEventAsync(string userName, string subjectId, SignInMessage signInMessage)
 {
     await _events.RaiseSuccessfulResourceOwnerFlowAuthenticationEventAsync(userName, subjectId, signInMessage);
 }
开发者ID:ryanmar,项目名称:IdentityServer3,代码行数:4,代码来源:TokenRequestValidator.cs

示例13: Login

 /// <summary>
 /// Loads the HTML for the login page.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <param name="message">The message.</param>
 /// <returns>
 /// Stream for the HTML
 /// </returns>
 public virtual Task<Stream> Login(LoginViewModel model, SignInMessage message)
 {
     return Render(model, LoginView);
 }
开发者ID:ryanmar,项目名称:IdentityServer3,代码行数:12,代码来源:DefaultViewService.cs

示例14: LoginExternalCallback_UserIsAnonymous_NoSubjectIsPassedToUserService

        public void LoginExternalCallback_UserIsAnonymous_NoSubjectIsPassedToUserService()
        {
            var msg = new SignInMessage();
            msg.IdP = "Google";
            msg.ReturnUrl = Url("authorize");
            var resp1 = GetLoginPage(msg);

            var sub = new Claim(Constants.ClaimTypes.Subject, "123", ClaimValueTypes.String, "Google");
            SignInIdentity = new ClaimsIdentity(new Claim[] { sub }, Constants.ExternalAuthenticationType);
            var resp2 = client.GetAsync(resp1.Headers.Location.AbsoluteUri).Result;
            client.SetCookies(resp2.GetCookies());

            Get(Constants.RoutePaths.LoginExternalCallback);

            mockUserService.Verify(x => x.AuthenticateExternalAsync(It.IsAny<ExternalAuthenticationContext>()));
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:16,代码来源:AuthenticationControllerTests.cs

示例15: LoginExternalCallback_UserServiceReturnsNull_ShowError

        public void LoginExternalCallback_UserServiceReturnsNull_ShowError()
        {
            mockUserService.Setup(x => x.AuthenticateExternalAsync(It.IsAny<ExternalAuthenticationContext>()))
                .Returns(Task.FromResult((AuthenticateResult)null));

            var msg = new SignInMessage();
            msg.IdP = "Google";
            msg.ReturnUrl = Url("authorize");
            var resp1 = GetLoginPage(msg);

            var sub = new Claim(Constants.ClaimTypes.Subject, "123", ClaimValueTypes.String, "Google");
            SignInIdentity = new ClaimsIdentity(new Claim[] { sub }, Constants.ExternalAuthenticationType);
            var resp2 = client.GetAsync(resp1.Headers.Location.AbsoluteUri).Result;
            client.SetCookies(resp2.GetCookies());

            var resp3 = Get(Constants.RoutePaths.LoginExternalCallback);
            resp3.AssertPage("login");
            var model = resp3.GetModel<LoginViewModel>();
            model.ErrorMessage.Should().Be(Messages.NoMatchingExternalAccount);
        }
开发者ID:rbottieri,项目名称:IdentityServer3,代码行数:20,代码来源:AuthenticationControllerTests.cs


注:本文中的IdentityServer3.Core.Models.SignInMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。