@Override public Credentials getCredentials() throws RepositoryException { return delegate.getCredentials(); }
@NotNull @Override public Credentials perform() throws RepositoryException { return getDelegate().getCredentials(); } });
@NotNull @Override public Credentials perform() throws RepositoryException { return getDelegate().getCredentials(); } });
@Nonnull @Override public Credentials perform() throws RepositoryException { return getDelegate().getCredentials(); } });
@Override public Credentials getCredentials() throws RepositoryException { return getDelegate().getCredentials(); }
@Override public Credentials getCredentials() throws RepositoryException { return getDelegate().getCredentials(); }
@Override public Credentials getCredentials() throws RepositoryException { return getDelegate().getCredentials(); }
/** * Create a new <code>Authentication</code> instance for the given <code>User</code>. * * @param user to create the Authentication. * @throws javax.jcr.RepositoryException If an error occurs. */ SimpleCredentialsAuthentication(User user) throws RepositoryException { Credentials creds = user.getCredentials(); if (creds instanceof CryptedSimpleCredentials) { this.creds = (CryptedSimpleCredentials) creds; } else if (creds instanceof SimpleCredentials) { try { this.creds = new CryptedSimpleCredentials((SimpleCredentials) creds); } catch (NoSuchAlgorithmException e) { throw new RepositoryException(e); } catch (UnsupportedEncodingException e) { throw new RepositoryException(e); } } else { log.warn("No Credentials found with user " + user.getID()); this.creds = null; } }
/** * Create a new <code>Authentication</code> instance for the given <code>User</code>. * * @param user to create the Authentication. * @throws javax.jcr.RepositoryException If an error occurs. */ SimpleCredentialsAuthentication(User user) throws RepositoryException { Credentials creds = user.getCredentials(); if (creds instanceof CryptedSimpleCredentials) { this.creds = (CryptedSimpleCredentials) creds; } else if (creds instanceof SimpleCredentials) { try { this.creds = new CryptedSimpleCredentials((SimpleCredentials) creds); } catch (NoSuchAlgorithmException e) { throw new RepositoryException(e); } catch (UnsupportedEncodingException e) { throw new RepositoryException(e); } } else { log.warn("No Credentials found with user " + user.getID()); this.creds = null; } }
public void testUserHasCredentials() throws RepositoryException, NotExecutableException { User user = getTestUser(superuser); Credentials creds = user.getCredentials(); assertTrue(creds != null); }
@Test public void testGetCredentials() throws RepositoryException { // EXERCISE look at the Credentials object returned from the system user and compare it with the result from PasswordTest#getCredentials() Credentials creds = systemUser.getCredentials(); // EXERCISE fix the expectation Credentials expected = null; assertEquals(expected, creds); } }
public void testLoginWithCryptedCredentials() throws RepositoryException { User u = (User) uMgr.getAuthorizable(uID); Credentials creds = u.getCredentials(); assertTrue(creds instanceof CryptedSimpleCredentials); try { Session s = getHelper().getRepository().login(u.getCredentials()); s.logout(); fail("Login using CryptedSimpleCredentials must fail."); } catch (LoginException e) { // success } } }
public void testGetCredentials() throws RepositoryException { testUser = userManager.createUser(testId, TEST_PW); Credentials creds = testUser.getCredentials(); // EXERCISE fix the expectation Credentials expected = null; assertEquals(expected, creds); // EXERCISE : complete and explain the expected behavior getHelper().getRepository().login(creds).logout(); }
public void testCredentials() throws RepositoryException, NoSuchAlgorithmException, UnsupportedEncodingException { User u = (User) userMgr.getAuthorizable(uID); Credentials uc = u.getCredentials(); assertTrue(uc instanceof CryptedSimpleCredentials); assertTrue(((CryptedSimpleCredentials) uc).matches((SimpleCredentials) creds)); }
@Test public void testGetCredentials() throws Exception { User user = createUser(null); Credentials creds = user.getCredentials(); assertTrue(creds instanceof UserIdCredentials); UserIdCredentials impl = (UserIdCredentials) creds; assertEquals(uid, impl.getUserId()); }
@Test public void testLoginAsSystemUser2() throws Exception { User user = createUser(null); try { login(user.getCredentials()).close(); fail(); } catch (LoginException e) { // success } }
@Test public void testLoginWithGetCredentials() throws RepositoryException, NotExecutableException { try { Credentials creds = user.getCredentials(); Session s = getHelper().getRepository().login(creds); s.logout(); fail("Login using credentials exposed on user must fail."); } catch (UnsupportedRepositoryOperationException e) { throw new NotExecutableException(e.getMessage()); } catch (LoginException e) { // success } } }
@Test public void testGetCredentialsUserWithoutPassword() throws Exception { user = userMgr.createUser(uid, null); root.commit(); Credentials creds = user.getCredentials(); assertTrue(creds instanceof UserIdCredentials); assertEquals(uid, ((UserIdCredentials) creds).getUserId()); } }
public void testUserImplHasCryptedSimplCredentials() throws RepositoryException, NotExecutableException { User user = getTestUser(superuser); Credentials creds = user.getCredentials(); assertNotNull(creds); assertTrue(creds instanceof CryptedSimpleCredentials); assertEquals(((CryptedSimpleCredentials) creds).getUserID(), user.getID()); }
@Test public void testGetCredentials() throws Exception { user = userMgr.createUser(uid, uid); root.commit(); Credentials creds = user.getCredentials(); assertTrue(creds instanceof CredentialsImpl); CredentialsImpl cImpl = (CredentialsImpl) creds; assertEquals(uid, cImpl.getUserId()); assertTrue(PasswordUtil.isSame(cImpl.getPasswordHash(), uid)); }