use of org.craftercms.profile.api.TenantPermission in project profile by craftercms.
the class AccessTokenCheckingInterceptorTest method getNormalToken.
private AccessToken getNormalToken() {
TenantPermission permission = new TenantPermission();
permission.allowAny();
AccessToken token = new AccessToken();
token.setId(NORMAL_TOKEN_ID);
token.setApplication(APPLICATION);
token.setMaster(true);
token.setTenantPermissions(Arrays.asList(permission));
token.setExpiresOn(new Date(System.currentTimeMillis() + TimeUnit.HOURS.toMillis(24)));
return token;
}
use of org.craftercms.profile.api.TenantPermission in project profile by craftercms.
the class AccessTokenCheckingInterceptorTest method getExpiredToken.
private AccessToken getExpiredToken() {
TenantPermission permission = new TenantPermission();
permission.allowAny();
AccessToken token = new AccessToken();
token.setId(EXPIRED_TOKEN_ID);
token.setApplication(APPLICATION);
token.setMaster(true);
token.setTenantPermissions(Arrays.asList(permission));
token.setExpiresOn(new Date());
return token;
}
use of org.craftercms.profile.api.TenantPermission in project profile by craftercms.
the class AccessTokenServiceIT method getCrafterStudioAccessToken.
private AccessToken getCrafterStudioAccessToken() {
TenantPermission permission = new TenantPermission();
permission.allowAny();
AccessToken token = new AccessToken();
token.setApplication(CRAFTER_STUDIO_APPLICATION);
token.setMaster(true);
token.setTenantPermissions(Arrays.asList(permission));
token.setExpiresOn(EXPIRES_ON);
return token;
}
use of org.craftercms.profile.api.TenantPermission in project profile by craftercms.
the class AccessTokenCheckingInterceptorTest method testPreHandle.
@Test
public void testPreHandle() throws Exception {
MockHttpServletRequest request = new MockHttpServletRequest();
request.setParameter(ProfileConstants.PARAM_ACCESS_TOKEN_ID, NORMAL_TOKEN_ID);
interceptor.preHandle(request, null, null);
AccessToken token = AccessTokenUtils.getAccessToken(request);
TenantPermission permission = new TenantPermission();
permission.allow("*");
assertNotNull(token);
assertEquals(APPLICATION, token.getApplication());
assertTrue(token.isMaster());
assertEquals(Arrays.asList(permission), token.getTenantPermissions());
verify(tokenRepository).findByStringId(NORMAL_TOKEN_ID);
}
use of org.craftercms.profile.api.TenantPermission in project profile by craftercms.
the class AccessTokenServiceImplTest method getNormalToken.
private AccessToken getNormalToken() {
TenantPermission permission = new TenantPermission();
permission.allowAny();
AccessToken token = new AccessToken();
token.setId(TOKEN_ID);
token.setApplication(APPLICATION);
token.setMaster(true);
token.setTenantPermissions(Arrays.asList(permission));
token.setExpiresOn(EXPIRES_ON);
return token;
}
Aggregations