use of org.craftercms.profile.api.AccessToken in project profile by craftercms.
the class AccessTokenServiceImplTest method testCreateToken.
@Test
public void testCreateToken() throws Exception {
AccessToken expected = getNormalToken();
AccessToken actual = accessTokenService.createToken(getNormalToken());
assertNotNull(actual);
assertNotNull(actual.getId());
assertEquals(expected.getApplication(), actual.getApplication());
assertEquals(expected.isMaster(), actual.isMaster());
assertEquals(expected.getTenantPermissions(), actual.getTenantPermissions());
assertEquals(expected.getExpiresOn(), actual.getExpiresOn());
verify(accessTokenRepository).insert(actual);
}
use of org.craftercms.profile.api.AccessToken in project profile by craftercms.
the class AccessTokenServiceImplTest method getCurrentToken.
private AccessToken getCurrentToken() {
AccessToken token = new AccessToken();
token.setId(CURRENT_TOKEN_ID);
token.setMaster(true);
return token;
}
use of org.craftercms.profile.api.AccessToken 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.AccessToken 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.AccessToken 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;
}
Aggregations