opened
edmundday
username_0
When I e.g. create a new client under 'Manage clients' it works OK, but once the server is stopped and restarted it has gone. Same for whitelisting. Can anyone point me in the right direction? Thanks.
Server not saving administrative data
issue
created
kabiliravi
username_1
@username_0 I guess you are running the app using the default database configurations which is pointing to an embedded HSQL database.

Look at this file:
https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/blob/master/openid-connect-server-webapp/src/main/webapp/WEB-INF/data-context.xml

Comment following part and uncomment the mysql one.
`
	<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
		<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
		<property name="jdbcUrl" value="jdbc:hsqldb:mem:oic;sql.syntax_mys=true" />
<!-- 		<property name="jdbcUrl" value="jdbc:hsqldb:file:/tmp/oic;sql.syntax_mys=true" /> -->
		<property name="username" value="oic" />
		<property name="password" value="oic" />
	</bean>

	<!-- Use the following to set up the OIC tables in the in-memory DB
 		   If you are using a file based HSQLDB you should not run this every time. -->
	<jdbc:initialize-database data-source="dataSource">
		<jdbc:script location="classpath:/db/hsql/hsql_database_tables.sql"/>
		<!-- The following file is for the jdbc-user-service spring security implementation -->
		<jdbc:script location="classpath:/db/hsql/security-schema.sql"/>
		<!-- The following files are for safely bootstrapping users and clients into the database -->
		<jdbc:script location="classpath:/db/hsql/loading_temp_tables.sql"/>
		<jdbc:script location="classpath:/db/hsql/users.sql"/>
		<jdbc:script location="classpath:/db/hsql/clients.sql"/>
		<jdbc:script location="classpath:/db/hsql/scopes.sql"/>
	</jdbc:initialize-database>

	<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
 		<property name="databasePlatform" value="org.eclipse.persistence.platform.database.HSQLPlatform" />
		<property name="showSql" value="true" />
	</bean>
`
comment
created
edmundday
username_0
Many thanks. Do I need to create the DB first time?
Is there any documentation on this?
comment
created
kabiliravi
username_1
@username_0 Yes you need to create the DB. For mysql you should name it "oic" or change the JDBC url to match your db name and connection url. According to the current default conf it is  **value="jdbc:mysql://127.0.0.1:3306/oic"**

And the following tag will run the scripts for you on the app initialization:

	<!-- You can optionally initialize the database with test values here, 
		but this is not recommended for real systems -->
<!-- 	<jdbc:initialize-database data-source="dataSource"> -->
<!-- 		<jdbc:script location="classpath:/db/tables/mysql_database_tables.sql"/> -->
<!-- 		<jdbc:script location="classpath:/db/tables/security-schema.sql"/> -->
<!-- 		<jdbc:script location="classpath:/db/tables/loading_temp_tables.sql"/> -->
<!-- 		<jdbc:script location="classpath:/db/mysql/users.sql"/> -->
<!-- 		<jdbc:script location="classpath:/db/mysql/clients.sql"/> -->
<!-- 		<jdbc:script location="classpath:/db/mysql/scopes.sql"/> -->
<!-- 	</jdbc:initialize-database> -->

However, you can keep the above tag commented and manually initialize database yourself. 
The scripts are here for HSQL, MySQL, Oracle and PostgreSQL

https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/tree/master/openid-connect-server-webapp/src/main/resources/db
comment
created
edmundday
username_0
Thanks! i have got some way with this but am stuck with  Table 'oic.users' doesn't exist. Any idea what format this able should be? I cannot find it any of the scripts.
comment
created
edmundday
username_0
I just used the temp version. Now I have to figure out where to add logins to the server. I cannot login to it to do so because none are set up!
comment
created
edmundday
username_0
Looks like users.sql does that.
comment
created
kabiliravi
username_1
@username_0 yes all scripts are in https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server/tree/master/openid-connect-server-webapp/src/main/resources/db and security-schema.sql is for creating the users and authorities  and users.sql for initiating some test data
comment