use of javax.jcr.GuestCredentials in project jackrabbit-oak by apache.
the class RepositoryTest method loginWithAttribute.
@Test
public void loginWithAttribute() throws RepositoryException {
Session session = ((JackrabbitRepository) getRepository()).login(new GuestCredentials(), null, Collections.<String, Object>singletonMap(RepositoryImpl.REFRESH_INTERVAL, 42));
String[] attributeNames = session.getAttributeNames();
assertEquals(1, attributeNames.length);
assertEquals(RepositoryImpl.REFRESH_INTERVAL, attributeNames[0]);
assertEquals(42L, session.getAttribute(RepositoryImpl.REFRESH_INTERVAL));
session.logout();
}
use of javax.jcr.GuestCredentials in project jackrabbit-oak by apache.
the class RepositoryTest method loginInvalidWorkspace.
@Test(expected = NoSuchWorkspaceException.class)
public void loginInvalidWorkspace() throws RepositoryException {
Repository repository = getRepository();
repository.login(new GuestCredentials(), "invalid");
}
use of javax.jcr.GuestCredentials in project jackrabbit-oak by apache.
the class L2_AuthInfoTest method testGuestAuthInfo.
@Test
public void testGuestAuthInfo() throws LoginException, NoSuchWorkspaceException {
contentSession = login(new GuestCredentials());
AuthInfo authInfo = contentSession.getAuthInfo();
// EXERCISE : fill in the expected id
String expectedId = null;
assertEquals(expectedId, authInfo.getUserID());
// EXERCISE: create the set of expected principals.
// EXERCISE: what are the variants you have at hand when using the Jackrabbit API
// EXERCISE: what are the variants you have at hand when using public Oak SPI interfaces?
Set<Principal> expectedPrincipals = null;
assertEquals(expectedPrincipals, authInfo.getPrincipals());
}
use of javax.jcr.GuestCredentials in project jackrabbit-oak by apache.
the class L3_LoginModuleTest method testLogin.
@Test
public void testLogin() throws LoginException, NoSuchWorkspaceException, IOException {
ContentSession contentSession = login(new GuestCredentials());
contentSession.close();
}
use of javax.jcr.GuestCredentials in project jackrabbit-oak by apache.
the class LoginModuleImplTest method testGuestLogin.
@Test
public void testGuestLogin() throws Exception {
try (ContentSession cs = login(new GuestCredentials())) {
AuthInfo authInfo = cs.getAuthInfo();
String anonymousID = UserUtil.getAnonymousId(getUserConfiguration().getParameters());
assertEquals(anonymousID, authInfo.getUserID());
}
}
Aggregations