use of org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database in project molgenis-emx2 by molgenis.
the class OIDCController method handleLoginCallback.
public Object handleLoginCallback(Request request, Response response) {
final SparkWebContext context = new SparkWebContext(request, response);
final HttpActionAdapter adapter = FindBest.httpActionAdapter(null, securityConfig, SparkHttpActionAdapter.INSTANCE);
final CallbackLogic callbackLogic = FindBest.callbackLogic(null, securityConfig, DefaultCallbackLogic.INSTANCE);
callbackLogic.perform(context, sessionStore, securityConfig, adapter, null, false, OIDC_CLIENT_NAME);
final ProfileManager manager = new ProfileManager(context, sessionStore);
Optional<UserProfile> oidcProfile = manager.getProfile();
if (oidcProfile.isEmpty()) {
logger.error("OIDC sign in failed, no profile found");
response.status(500);
response.redirect("/");
return response;
}
String user = oidcProfile.get().getAttribute("email").toString();
if (user == null || user.isEmpty()) {
logger.error("OIDC sign in failed, email claim is empty");
response.status(500);
response.redirect("/");
return response;
}
Database database = sessionManager.getSession(request).getDatabase();
if (!database.hasUser(user)) {
logger.info("Add new OIDC user({}) to database", user);
database.addUser(user);
}
database.setActiveUser(user);
logger.info("OIDC sign in for user: {}", user);
response.status(302);
response.redirect("/");
return response;
}
use of org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database in project molgenis-emx2 by molgenis.
the class TestMgColumns method setUp.
@BeforeClass
public static void setUp() {
Database database = TestDatabaseFactory.getTestDatabase();
schema = database.dropCreateSchema(TestMgColumns.class.getSimpleName());
}
use of org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database in project molgenis-emx2 by molgenis.
the class TestEmx2Settings method setup.
@BeforeClass
public static void setup() {
Database database = TestDatabaseFactory.getTestDatabase();
schema = database.dropCreateSchema(TestEmx2Settings.class.getSimpleName());
}
use of org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database in project molgenis-emx2 by molgenis.
the class TestGraphqlCrossSchemaRefs method setup.
@BeforeClass
public static void setup() {
Database database = TestDatabaseFactory.getTestDatabase();
schema1 = database.dropCreateSchema(schemaName1);
schema2 = database.dropCreateSchema(schemaName2);
CrossSchemaReferenceExample.create(schema1, schema2);
graphql = new GraphqlApiFactory().createGraphqlForSchema(schema2);
}
use of org.jaxdb.www.sqlx_0_5.xLygluGCXAA.$Database in project jaxdb by jaxdb.
the class JSqlTest method loadEntitiesJaxSB.
@SuppressWarnings("unchecked")
static int loadEntitiesJaxSB(final Connection connection, final String name) throws ClassNotFoundException, IOException, SAXException, SQLException, TransformerException {
Database.threadLocal((Class<? extends Schema>) Class.forName(Entities.class.getPackage().getName() + "." + name)).connectPrepared(() -> connection);
final URL sqlx = ClassLoader.getSystemClassLoader().getResource("jaxdb/" + name + ".sqlx");
assertNotNull(sqlx);
final $Database database = ($Database) Bindings.parse(sqlx);
final DDLx ddlx = new DDLx(ClassLoader.getSystemClassLoader().getResource(name + ".ddlx"));
Schemas.truncate(connection, ddlx.getMergedSchema().getTable());
final Batch batch = new Batch();
final int expectedCount = DBVendor.valueOf(connection.getMetaData()) == DBVendor.ORACLE ? 0 : 1;
for (final data.Table<?> table : Entities.toEntities(database)) batch.addStatement(INSERT(table), (s, e, c) -> assertEquals(expectedCount, c));
return batch.execute();
}
Aggregations