Search in sources :

Example 6 with RememberMeUsernamePasswordCredential

use of org.apereo.cas.authentication.RememberMeUsernamePasswordCredential in project cas by apereo.

the class ShiroAuthenticationHandlerTests method checkAuthenticationSuccessful.

@Test
public void checkAuthenticationSuccessful() throws Exception {
    final ShiroAuthenticationHandler shiro = new ShiroAuthenticationHandler("", null, null, Collections.emptySet(), Collections.emptySet());
    shiro.loadShiroConfiguration(new ClassPathResource("shiro.ini"));
    final RememberMeUsernamePasswordCredential creds = new RememberMeUsernamePasswordCredential();
    creds.setRememberMe(true);
    creds.setUsername("casuser");
    creds.setPassword("Mellon");
    assertNotNull(shiro.authenticate(creds));
}
Also used : ClassPathResource(org.springframework.core.io.ClassPathResource) RememberMeUsernamePasswordCredential(org.apereo.cas.authentication.RememberMeUsernamePasswordCredential) Test(org.junit.Test)

Example 7 with RememberMeUsernamePasswordCredential

use of org.apereo.cas.authentication.RememberMeUsernamePasswordCredential in project cas by apereo.

the class ShiroAuthenticationHandlerTests method checkAuthenticationSuccessfulRolesAndPermissions.

@Test
public void checkAuthenticationSuccessfulRolesAndPermissions() throws Exception {
    final ShiroAuthenticationHandler shiro = new ShiroAuthenticationHandler("", null, null, Collections.singleton("admin"), Collections.singleton("superuser:deleteAll"));
    shiro.loadShiroConfiguration(new ClassPathResource("shiro.ini"));
    final RememberMeUsernamePasswordCredential creds = new RememberMeUsernamePasswordCredential();
    creds.setRememberMe(true);
    creds.setUsername("casuser");
    creds.setPassword("Mellon");
    assertNotNull(shiro.authenticate(creds));
}
Also used : ClassPathResource(org.springframework.core.io.ClassPathResource) RememberMeUsernamePasswordCredential(org.apereo.cas.authentication.RememberMeUsernamePasswordCredential) Test(org.junit.Test)

Aggregations

RememberMeUsernamePasswordCredential (org.apereo.cas.authentication.RememberMeUsernamePasswordCredential)7 Test (org.junit.Test)6 ClassPathResource (org.springframework.core.io.ClassPathResource)4 Authentication (org.apereo.cas.authentication.Authentication)2 AuthenticationBuilder (org.apereo.cas.authentication.AuthenticationBuilder)2 DefaultAuthenticationBuilder (org.apereo.cas.authentication.DefaultAuthenticationBuilder)2 AccountLockedException (javax.security.auth.login.AccountLockedException)1 AccountNotFoundException (javax.security.auth.login.AccountNotFoundException)1 CredentialExpiredException (javax.security.auth.login.CredentialExpiredException)1 FailedLoginException (javax.security.auth.login.FailedLoginException)1 AuthenticationException (org.apache.shiro.authc.AuthenticationException)1 DisabledAccountException (org.apache.shiro.authc.DisabledAccountException)1 ExcessiveAttemptsException (org.apache.shiro.authc.ExcessiveAttemptsException)1 ExpiredCredentialsException (org.apache.shiro.authc.ExpiredCredentialsException)1 IncorrectCredentialsException (org.apache.shiro.authc.IncorrectCredentialsException)1 LockedAccountException (org.apache.shiro.authc.LockedAccountException)1 UnknownAccountException (org.apache.shiro.authc.UnknownAccountException)1 UsernamePasswordToken (org.apache.shiro.authc.UsernamePasswordToken)1 Subject (org.apache.shiro.subject.Subject)1 AccountDisabledException (org.apereo.cas.authentication.exceptions.AccountDisabledException)1