Search in sources :

Example 11 with OSecurityUser

use of com.orientechnologies.orient.core.metadata.security.OSecurityUser in project orientdb by orientechnologies.

the class OTokenHandlerImplTest method testTokenNotRenew.

@Test
public void testTokenNotRenew() {
    ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:" + OTokenHandlerImplTest.class.getSimpleName());
    db.create();
    try {
        OSecurityUser original = db.getUser();
        OTokenHandlerImpl handler = new OTokenHandlerImpl("any key".getBytes(), 60, "HmacSHA256");
        ONetworkProtocolData data = new ONetworkProtocolData();
        data.driverName = "aa";
        data.driverVersion = "aa";
        data.serializationImpl = "a";
        data.protocolVersion = 2;
        byte[] token = handler.getSignedBinaryToken(db, original, data);
        OToken tok = handler.parseBinaryToken(token);
        token = handler.renewIfNeeded(tok);
        assertEquals(0, token.length);
    } finally {
        db.drop();
    }
}
Also used : ONetworkProtocolData(com.orientechnologies.orient.server.network.protocol.ONetworkProtocolData) OToken(com.orientechnologies.orient.core.metadata.security.OToken) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) OSecurityUser(com.orientechnologies.orient.core.metadata.security.OSecurityUser) Test(org.junit.Test)

Aggregations

OSecurityUser (com.orientechnologies.orient.core.metadata.security.OSecurityUser)11 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)5 OToken (com.orientechnologies.orient.core.metadata.security.OToken)5 Test (org.junit.Test)5 ONetworkProtocolData (com.orientechnologies.orient.server.network.protocol.ONetworkProtocolData)3 OModificationOperationProhibitedException (com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException)2 OUser (com.orientechnologies.orient.core.metadata.security.OUser)2 OLockException (com.orientechnologies.common.concur.lock.OLockException)1 OException (com.orientechnologies.common.exception.OException)1 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)1 ODatabaseListener (com.orientechnologies.orient.core.db.ODatabaseListener)1 ODatabaseDocument (com.orientechnologies.orient.core.db.document.ODatabaseDocument)1 OSchemaException (com.orientechnologies.orient.core.exception.OSchemaException)1 OSecurityAccessException (com.orientechnologies.orient.core.exception.OSecurityAccessException)1 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)1 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)1 ODistributedOperationException (com.orientechnologies.orient.server.distributed.task.ODistributedOperationException)1 ORemoteTask (com.orientechnologies.orient.server.distributed.task.ORemoteTask)1 Ignore (org.junit.Ignore)1