Commit d3cb43b9 authored by Matija Obreza's avatar Matija Obreza
Browse files

Startup: Updates for default OAuth client and SMTP configuration

- Ensure default client has TRUSTED_CLIENT role
- Default SMTP port is 25
parent a9de079b
......@@ -32,7 +32,7 @@ public class MailConfig {
@Value("${mail.host}")
private String host;
@Value("${mail.port}")
@Value("${mail.port:25}")
private Integer port;
@Value("${mail.user.name}")
......@@ -61,7 +61,9 @@ public class MailConfig {
}
final JavaMailSenderImpl sender = new JavaMailSenderImpl();
sender.setHost(host);
sender.setPort(port);
if (port != null) {
sender.setPort(port);
}
sender.setUsername(userName);
sender.setPassword(pwd);
sender.setJavaMailProperties(javaMailProperties());
......
......@@ -447,6 +447,7 @@ public class ApplicationStartup implements InitializingBean {
client.getAuthorizedGrantTypes().add("implicit");
client.getAuthorizedGrantTypes().add("webuser");
client.getRoles().add(OAuthRole.CLIENT);
client.getRoles().add(OAuthRole.TRUSTED_CLIENT);
client.getScope().add("read");
client.getScope().add("write");
client.getScope().add("trust");
......@@ -474,6 +475,7 @@ public class ApplicationStartup implements InitializingBean {
// client.getRegisteredRedirectUri().clear();
client.getRegisteredRedirectUri().add("oob");
client.getRegisteredRedirectUri().add(baseUrl + "/swagger-ui/oauth2-redirect.html");
client.getRoles().add(OAuthRole.TRUSTED_CLIENT);
oauthService.updateClient(client.getId(), client.getVersion(), client);
client = oauthClientRepository.findByClientId(defaultOAuthClientId);
......@@ -483,7 +485,6 @@ public class ApplicationStartup implements InitializingBean {
}
}
}
/**
* Ensure KSU Fieldbook app client.
......
......@@ -117,7 +117,7 @@ repository.blacklist.foldername=(^\\.)|[~!\\/]
# Mail properties
mail.host=
mail.port=
mail.port=25
mail.async=true
mail.debug=false
......
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