Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void verifyUser()
        public virtual void verifyUser()
        {
            when(processEngine.IdentityService.checkPassword(TEST_USERNAME, TEST_PASSWORD)).thenReturn(true);

            BasicUserCredentialsDto userCredentialsDto = new BasicUserCredentialsDto();

            userCredentialsDto.Username = TEST_USERNAME;
            userCredentialsDto.Username = TEST_PASSWORD;
            given().body(userCredentialsDto).contentType(ContentType.JSON).expect().statusCode(Status.BAD_REQUEST.StatusCode).contentType(ContentType.JSON).body("type", equalTo(typeof(InvalidRequestException).Name)).body("message", equalTo("Username and password are required")).when().post(VERIFY_USER_URL);
        }
Esempio n. 2
0
        public virtual AuthenticationResult verifyUser(BasicUserCredentialsDto credentialsDto)
        {
            if (string.ReferenceEquals(credentialsDto.Username, null) || string.ReferenceEquals(credentialsDto.Password, null))
            {
                throw new InvalidRequestException(Response.Status.BAD_REQUEST, "Username and password are required");
            }
            IdentityService identityService = ProcessEngine.IdentityService;
            bool            valid           = identityService.checkPassword(credentialsDto.Username, credentialsDto.Password);

            if (valid)
            {
                return(AuthenticationResult.successful(credentialsDto.Username));
            }
            else
            {
                return(AuthenticationResult.unsuccessful(credentialsDto.Username));
            }
        }