Search in sources :

Example 41 with AuthInfo

use of org.apache.jackrabbit.oak.api.AuthInfo in project jackrabbit-oak by apache.

the class ContentRemoteSessionTest method testReadRevisionAsString.

@Test
public void testReadRevisionAsString() {
    Root root = mock(Root.class);
    AuthInfo authInfo = mock(AuthInfo.class);
    ContentSession session = mock(ContentSession.class);
    doReturn(authInfo).when(session).getAuthInfo();
    ContentRemoteRevisions revisions = mock(ContentRemoteRevisions.class);
    doReturn(root).when(revisions).get(authInfo, "id");
    assertEquals("id", createSession(session, revisions).readRevision("id").asString());
}
Also used : AuthInfo(org.apache.jackrabbit.oak.api.AuthInfo) Root(org.apache.jackrabbit.oak.api.Root) ContentSession(org.apache.jackrabbit.oak.api.ContentSession) Test(org.junit.Test)

Example 42 with AuthInfo

use of org.apache.jackrabbit.oak.api.AuthInfo in project jackrabbit-oak by apache.

the class ContentRemoteSessionTest method testReadRevision.

@Test
public void testReadRevision() {
    Root root = mock(Root.class);
    AuthInfo authInfo = mock(AuthInfo.class);
    ContentSession session = mock(ContentSession.class);
    doReturn(authInfo).when(session).getAuthInfo();
    ContentRemoteRevisions revisions = mock(ContentRemoteRevisions.class);
    doReturn(root).when(revisions).get(authInfo, "id");
    assertNotNull(createSession(session, revisions).readRevision("id"));
}
Also used : AuthInfo(org.apache.jackrabbit.oak.api.AuthInfo) Root(org.apache.jackrabbit.oak.api.Root) ContentSession(org.apache.jackrabbit.oak.api.ContentSession) Test(org.junit.Test)

Aggregations

AuthInfo (org.apache.jackrabbit.oak.api.AuthInfo)42 Test (org.junit.Test)38 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)26 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)24 SimpleCredentials (javax.jcr.SimpleCredentials)19 Subject (javax.security.auth.Subject)15 LoginException (javax.security.auth.login.LoginException)7 Principal (java.security.Principal)6 ImpersonationCredentials (org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials)6 GuestCredentials (javax.jcr.GuestCredentials)5 AuthInfoImpl (org.apache.jackrabbit.oak.spi.security.authentication.AuthInfoImpl)5 Credentials (javax.jcr.Credentials)4 Root (org.apache.jackrabbit.oak.api.Root)4 SystemSubject (org.apache.jackrabbit.oak.spi.security.authentication.SystemSubject)4 RepositoryException (javax.jcr.RepositoryException)3 PrivilegedActionException (java.security.PrivilegedActionException)2 PrivilegedExceptionAction (java.security.PrivilegedExceptionAction)2 Session (javax.jcr.Session)2 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)2 UserManager (org.apache.jackrabbit.api.security.user.UserManager)2