Beispiel #1
0
        public LoginResponse Login([FromBody] UserLoginPayload payload)
        {
            UserValidationService userValidationService = new UserValidationService();
            LoginResponse         response = userValidationService.ValidateLogin(payload.Username, payload.Password);

            if (response == null)
            {
                Response.StatusCode = 401;
            }

            return(response);
        }
        private object GetLoginBody(string loginId, string secret, AuthType authType)
        {
            object body = null;

            if (authType == AuthType.Organization || authType == AuthType.Application)
            {
                body = new ClientIdLoginPayload
                    {
                        ClientId = loginId,
                        ClientSecret = secret
                    };
            }
            else if (authType == AuthType.User)
            {
                body = new UserLoginPayload
                    {
                        UserName = loginId,
                        Password = secret
                    };
            }
            return body;
        }
Beispiel #3
0
        private object GetLoginBody(string loginId, string secret, AuthType authType)
        {
            object body = null;

            if (authType == AuthType.ClientId || authType == AuthType.Application)
            {
                body = new ClientIdLoginPayload
                {
                    ClientId     = loginId,
                    ClientSecret = secret
                };
            }
            else if (authType == AuthType.User)
            {
                body = new UserLoginPayload
                {
                    UserName = loginId,
                    Password = secret
                };
            }
            return(body);
        }