Added setting default access scopes in the config file & fixed #21.
Change-Id: Ic9cdf2c1aed100d6c0aa37f4d1195a3f6f2c3fda
diff --git a/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql b/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
index 28a5de2..a76e745 100644
--- a/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
+++ b/full/src/main/resources/db/new-sqlite/V1.4__oauth2_tables.sql
@@ -33,18 +33,17 @@
CREATE UNIQUE INDEX authorization_index on oauth2_authorization(code, client_id);
CREATE TABLE IF NOT EXISTS oauth2_access_scope (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- name VARCHAR(200) NOT NULL
+ id VARCHAR(200) PRIMARY KEY NOT NULL
);
CREATE TABLE IF NOT EXISTS oauth2_authorization_scope (
id INTEGER PRIMARY KEY AUTOINCREMENT,
authorization_id INTEGER NOT NULL,
- scope_id INTEGER NOT NULL,
+ scope_id VARCHAR(200) NOT NULL,
FOREIGN KEY (authorization_id)
REFERENCES oauth2_authorization(id),
FOREIGN KEY (scope_id)
- REFERENCES access_scope(id)
+ REFERENCES oauth2_access_scope(id)
);
CREATE UNIQUE INDEX authorization_scope_index on
diff --git a/full/src/main/resources/default-config.xml b/full/src/main/resources/default-config.xml
index 955d197..eef04e8 100644
--- a/full/src/main/resources/default-config.xml
+++ b/full/src/main/resources/default-config.xml
@@ -56,11 +56,6 @@
class='org.springframework.cache.ehcache.EhCacheManagerFactoryBean'
p:configLocation='classpath:ehcache.xml' p:shared='true' />
- <!-- props are injected from default-config.xml -->
- <bean id="kustvakt_config" class="de.ids_mannheim.korap.config.FullConfiguration">
- <constructor-arg name="properties" ref="props" />
- </bean>
-
<!--class="org.apache.commons.dbcp2.BasicDataSource" -->
<!-- org.springframework.jdbc.datasource.SingleConnectionDataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource"
@@ -163,7 +158,18 @@
<!-- Data access objects -->
<bean id="resourceDao" class="de.ids_mannheim.korap.dao.ResourceDao" />
- <!-- <bean id="annotationDao" class="de.ids_mannheim.korap.dao.AnnotationDao"/> -->
+ <bean id="accessScopeDao" class="de.ids_mannheim.korap.oauth2.dao.AccessScopeDao" />
+
+ <!-- props are injected from default-config.xml -->
+ <bean id="kustvakt_config" class="de.ids_mannheim.korap.config.FullConfiguration">
+ <constructor-arg name="properties" ref="props" />
+ </bean>
+
+ <bean id="initializator" class="de.ids_mannheim.korap.config.Initializator"
+ init-method="init">
+ <constructor-arg name="config" ref="kustvakt_config" />
+ <constructor-arg name="accessScopeDao" ref="accessScopeDao" />
+ </bean>
<!-- Krill -->
<bean id="search_krill" class="de.ids_mannheim.korap.web.SearchKrill">