Java Code Examples for org.jasig.cas.TestUtils#getCredentialsWithDifferentUsernameAndPassword()
The following examples show how to use
org.jasig.cas.TestUtils#getCredentialsWithDifferentUsernameAndPassword() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthenticationViaFormActionTests.java From springboot-shiro-cas-mybatis with MIT License | 6 votes |
@Test public void verifyRenewWithServiceAndBadCredentials() throws Exception { final Credential c = TestUtils.getCredentialsWithSameUsernameAndPassword(); final TicketGrantingTicket ticketGrantingTicket = getCentralAuthenticationService().createTicketGrantingTicket(c); final MockHttpServletRequest request = new MockHttpServletRequest(); final MockRequestContext context = new MockRequestContext(); WebUtils.putTicketGrantingTicketInScopes(context, ticketGrantingTicket); request.addParameter("renew", "true"); request.addParameter("service", "test"); final Credential c2 = TestUtils.getCredentialsWithDifferentUsernameAndPassword(); context.setExternalContext(new ServletExternalContext( new MockServletContext(), request, new MockHttpServletResponse())); putCredentialInRequestScope(context, c2); context.getRequestScope().put( "org.springframework.validation.BindException.credentials", new BindException(c2, "credentials")); final MessageContext messageContext = mock(MessageContext.class); assertEquals("error", this.action.submit(context, c2, messageContext).getId()); }
Example 2
Source File: SearchModeSearchDatabaseAuthenticationHandlerTests.java From springboot-shiro-cas-mybatis with MIT License | 4 votes |
@Test(expected = FailedLoginException.class) public void verifyNotFoundUser() throws Exception { final UsernamePasswordCredential c = TestUtils.getCredentialsWithDifferentUsernameAndPassword("hello", "world"); this.handler.authenticateUsernamePasswordInternal(c); }
Example 3
Source File: SearchModeSearchDatabaseAuthenticationHandlerTests.java From springboot-shiro-cas-mybatis with MIT License | 4 votes |
@Test public void verifyFoundUser() throws Exception { final UsernamePasswordCredential c = TestUtils.getCredentialsWithDifferentUsernameAndPassword("user3", "psw3"); assertNotNull(this.handler.authenticateUsernamePasswordInternal(c)); }
Example 4
Source File: SearchModeSearchDatabaseAuthenticationHandlerTests.java From springboot-shiro-cas-mybatis with MIT License | 4 votes |
@Test public void verifyMultipleUsersFound() throws Exception { final UsernamePasswordCredential c = TestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "psw0"); assertNotNull(this.handler.authenticateUsernamePasswordInternal(c)); }