public UUID getApplicationId() { return application.getUuid(); }
throw e; applicationId = application.getUuid();
public SignInAsProvider foursquare( Application application ) { FoursquareProvider foursquareProvider = new FoursquareProvider( emf.getEntityManager( application.getUuid() ), managementService ); foursquareProvider.configure(); return foursquareProvider; }
public SignInAsProvider pingident( Application application ) { PingIdentityProvider pingIdentityProvider = new PingIdentityProvider( emf.getEntityManager( application.getUuid() ), managementService ); pingIdentityProvider.configure(); return pingIdentityProvider; } }
public SignInAsProvider facebook( Application application ) { FacebookProvider facebookProvider = new FacebookProvider( emf.getEntityManager( application.getUuid() ), managementService ); facebookProvider.configure(); return facebookProvider; }
@Override public void doWrite(EntityManager em, FileImport fileImport, FileImportTracker tracker) { try { if (logger.isTraceEnabled()) { logger.trace("Writing imported entity {}:{} into app {}", entityType, entityUuid, em.getApplication().getUuid()); } em.create(entityUuid, entityType, properties); tracker.entityWritten(); } catch (Exception e) { logger.error("Error writing entity. From file:{}", fileImport.getFileName(), e); tracker.entityFailed(e.getMessage() + " From file: " + fileImport.getFileName()); } } }
user = managementService.getAppUserByIdentifier(entityManager.getApplication().getUuid(), Identifier.fromEmail(pingUser.get("username").toString())); } catch (Exception ex) {
user = managementService.getAppUserByIdentifier( entityManager.getApplication().getUuid(), Identifier.fromEmail( fb_user_email ) );
+ CpNamingUtils.MANAGEMENT_APPLICATION_ID + " should never be null"); Id managementId = new SimpleId( managementApp.getUuid(), managementApp.getType() );
final UUID appId = em.getApplication().getUuid(); final Map<String, Object> payloads = notification.getPayloads();
add( createdApplication.getUuid() ); }};
put( "path", organization.getName() + em.getApplication().getName()); put( "organizationId", organization.getUuid()); put( "applicationId", em.getApplication().getUuid() ); put( "collectionName", collectionName); put( "properties", new HashMap<String, Object>() {{
/** * Create test entities of a specified type. * First two entities are connected. */ private void createTestEntities(final EntityManager em, Map<UUID, Entity> thingsMap, List<Entity> things, final String type) throws Exception { logger.debug("\n\nCreating new {} collection in application {}\n", type, em.getApplication().getName()); setup.getEntityIndex().refresh(em.getApplicationId()); List<Entity> created = new ArrayList<>(); for (int i = 0; i < 10; i++) { final int count = i; Entity e = em.create(type, new HashMap<String, Object>() {{ put("name", em.getApplication().getName() + "-" + type + "-" + count); put("originalAppId", em.getApplication().getUuid()); put("originalAppName", em.getApplication().getName()); }}); thingsMap.put(e.getUuid(), e); things.add(e); created.add(e); } // first two things are related to each other em.createConnection(new SimpleEntityRef(type, created.get(0).getUuid()), "related", new SimpleEntityRef(type, created.get(1).getUuid())); em.createConnection(new SimpleEntityRef(type, created.get(1).getUuid()), "related", new SimpleEntityRef(type, created.get(0).getUuid())); setup.getEntityIndex().refresh(em.getApplicationId()); }
final Import importEntity = importService.schedule(em.getApplication().getUuid(), new HashMap<String, Object>() {{ put( "path", organization.getName() + em.getApplication().getName() ); put( "organizationId", organization.getUuid() ); put( "applicationId", em.getApplication().getUuid() ); put( "properties", new HashMap<String, Object>() {{ put( "storage_provider", "s3" );
@Override public void call( final Edge edge ) { final String edgeType = edge.getType(); final Id source = edge.getSourceNode(); //test if we're a collection, if so if ( EdgeTestUtils.isCollectionEdgeType( edgeType ) ) { final String collectionName = EdgeTestUtils.getNameForEdge( edgeType ); assertEquals("application source returned", createdApplication.getUuid(), source.getUuid()); final String expectedCollection = Schema.defaultCollectionName( target.getType() ); assertEquals("right type returned", expectedCollection, collectionName); return; } if ( !EdgeTestUtils.isConnectionEdgeType( edgeType ) ) { fail( "Only connection edges should be encountered" ); } final String connectionType = EdgeTestUtils.getNameForEdge( edgeType ); assertEquals( "Same connection type expected", "likes", connectionType ); assertTrue( "Element should be present on removal", sourceIdentities.remove( source ) ); } } ).toBlocking().lastOrDefault( null );
@Test public void appExpiration() throws Exception { ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo(); EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() ); Application app = em.getApplication(); long appTokenAge = 1000; app.setAccesstokenttl( appTokenAge ); em.updateApplication( app ); AuthPrincipalInfo userPrincipal = new AuthPrincipalInfo( AuthPrincipalType.APPLICATION_USER, UUIDUtils.newTimeUUID(), app.getUuid() ); String token = setup.getTokenSvc().createToken( TokenCategory.ACCESS, null, userPrincipal, null, 0 ); long start = System.currentTimeMillis(); assertNotNull( token ); TokenInfo tokenInfo = setup.getTokenSvc().getTokenInfo( token ); assertNotNull( tokenInfo ); assertEquals( appTokenAge, tokenInfo.getDuration() ); /** * Sleep at least expirationTime millis to allow token to expire */ Thread.sleep( appTokenAge - ( System.currentTimeMillis() - start ) + 1000 ); boolean invalidTokenException = false; try { setup.getTokenSvc().getTokenInfo( token ); } catch ( ExpiredTokenException ite ) { invalidTokenException = true; } assertTrue( invalidTokenException ); }
@Test public void appDefaultExpiration() throws Exception { ApplicationInfo appInfo = newOrgAppAdminRule.getApplicationInfo(); EntityManager em = setup.getEmf().getEntityManager( appInfo.getId() ); Application app = em.getApplication(); AuthPrincipalInfo userPrincipal = new AuthPrincipalInfo( AuthPrincipalType.APPLICATION_USER, UUIDUtils.newTimeUUID(), app.getUuid() ); String token = setup.getTokenSvc().createToken( TokenCategory.ACCESS, null, userPrincipal, null, 0 ); assertNotNull( token ); TokenInfo tokenInfo = setup.getTokenSvc().getTokenInfo( token ); assertNotNull( tokenInfo ); assertEquals( TokenServiceImpl.LONG_TOKEN_AGE, tokenInfo.getDuration() ); }
new AuthPrincipalInfo( AuthPrincipalType.APPLICATION_USER, UUIDUtils.newTimeUUID(), app.getUuid() );