use of oap.ws.Interceptor.USER_ID in project oap by oaplatform.
the class SecurityInterceptor2Test method testPostProcessing.
@Test
public void testPostProcessing() {
when(mockAclService.checkAll("1", "testUser")).thenReturn(asList("test1.read"));
final Session session = new Session();
session.set(USER_ID, "testUser");
val methodWithAnnotation = REFLECTION.method(method -> method.name().equals("methodWithAnnotation")).get();
val op = (ObjectWithPermissions) securityInterceptor.postProcessing(new TestAPI.Res("1"), session, methodWithAnnotation);
assertThat(op.permissions).containsExactlyInAnyOrder("test1.read");
}
Aggregations