Commit 1ebfd31c authored by Andrey Lugovskiy's avatar Andrey Lugovskiy
Browse files

Merge branch '88-make-default-oauth-client-configurable' into 'master'

Resolve "Make default OAuth client configurable"

Closes #88

See merge request !67
parents 8e2e97e8 427e2e2e
......@@ -9,6 +9,8 @@ services:
- host.name=catalog-${CI_COMMIT_REF_SLUG}.review.genesys-pgr.org
- default.admin.email=${DEFAULT_ADMIN_EMAIL}
- default.admin.password=${DEFAULT_ADMIN_PASSWORD}
- default.oauthclient.clientId=${DEFAULT_OAUTHCLIENT_ID}
- default.oauthclient.clientSecret=${DEFAULT_OAUTHCLIENT_SECRET}
- robots.allow=false
- db.url=jdbc:hsqldb:mem:catalog;sql.syntax_mys=true;sql.ignore_case=true
- db.driverClassName=org.hsqldb.jdbc.JDBCDriver
......
......@@ -45,8 +45,12 @@ public class StartupInitializer implements InitializingBean {
@Value("${default.admin.password}")
private String defaultAdminPassword;
@Value("${client.secret}")
private String clientSecret;
@Value("${default.oauthclient.clientId}")
private String defaultOAuthClientId;
@Value("${default.oauthclient.clientSecret}")
private String defaultOAuthClientSecret;
@Autowired
private UserRepository userRepository;
......@@ -79,8 +83,8 @@ public class StartupInitializer implements InitializingBean {
if (oauthClientRepository.count() == 0) {
LOG.warn("Creating default OAuth client my-trusted-client");
final OAuthClient client = new OAuthClient();
client.setClientId("my-trusted-client");
client.setClientSecret(clientSecret);
client.setClientId(defaultOAuthClientId);
client.setClientSecret(defaultOAuthClientSecret);
client.getAuthorizedGrantTypes().add("authorization_code");
client.getAuthorizedGrantTypes().add("password");
client.getAuthorizedGrantTypes().add("client_credentials");
......
......@@ -16,7 +16,8 @@ db.pool.maxActive=10
default.admin.email=admin@example.com
default.admin.password=Admin123!
client.secret=my-secret-client
default.oauthclient.clientId=my-trusted-client
default.oauthclient.clientSecret=my-secret-client
#google properties
google.consumerKey=
......
......@@ -18,6 +18,9 @@ db.pool.maxActive=5
default.admin.email=admin@example.com
default.admin.password=Admin123!
default.oauthclient.clientId=my-trusted-client
default.oauthclient.clientSecret=my-secret-client
#file repository
file.repository.path=/file_repository
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment