Skip to content
Snippets Groups Projects
Commit 2e2a4eb9 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Simplify checking for enabled auth services

The security.*.enabled properties are now loaded as booleans.
parent b1363a58
No related merge requests found
......@@ -36,9 +36,6 @@ import java.util.HashMap;
@Controller
@RequestMapping({"/configuration", "/arsnova-config"})
public class ConfigurationController extends AbstractController {
@Value("${security.guest.enabled}")
private String guestEnabled;
public static final Logger LOGGER = LoggerFactory
.getLogger(ConfigurationController.class);
......
......@@ -75,46 +75,46 @@ public class LoginController extends AbstractController {
@Value("${api.path:}") private String apiPath;
@Value("${customization.path}") private String customizationPath;
@Value("${security.guest.enabled}") private String guestEnabled;
@Value("${security.guest.enabled}") private boolean guestEnabled;
@Value("${security.guest.allowed-roles:speaker,student}") private String[] guestRoles;
@Value("${security.guest.order}") private int guestOrder;
@Value("${security.custom-login.enabled}") private String customLoginEnabled;
@Value("${security.custom-login.enabled}") private boolean customLoginEnabled;
@Value("${security.custom-login.allowed-roles:speaker,student}") private String[] customLoginRoles;
@Value("${security.custom-login.title:University}") private String customLoginTitle;
@Value("${security.custom-login.login-dialog-path}") private String customLoginDialog;
@Value("${security.custom-login.image:}") private String customLoginImage;
@Value("${security.custom-login.order}") private int customLoginOrder;
@Value("${security.user-db.enabled}") private String dbAuthEnabled;
@Value("${security.user-db.enabled}") private boolean dbAuthEnabled;
@Value("${security.user-db.allowed-roles:speaker,student}") private String[] dbAuthRoles;
@Value("${security.user-db.title:ARSnova}") private String dbAuthTitle;
@Value("${security.user-db.login-dialog-path}") private String dbAuthDialog;
@Value("${security.user-db.image:}") private String dbAuthImage;
@Value("${security.user-db.order}") private int dbAuthOrder;
@Value("${security.ldap.enabled}") private String ldapEnabled;
@Value("${security.ldap.enabled}") private boolean ldapEnabled;
@Value("${security.ldap.allowed-roles:speaker,student}") private String[] ldapRoles;
@Value("${security.ldap.title:LDAP}") private String ldapTitle;
@Value("${security.ldap.login-dialog-path}") private String ldapDialog;
@Value("${security.ldap.image:}") private String ldapImage;
@Value("${security.ldap.order}") private int ldapOrder;
@Value("${security.cas.enabled}") private String casEnabled;
@Value("${security.cas.enabled}") private boolean casEnabled;
@Value("${security.cas.allowed-roles:speaker,student}") private String[] casRoles;
@Value("${security.cas.title:CAS}") private String casTitle;
@Value("${security.cas.image:}") private String casImage;
@Value("${security.cas.order}") private int casOrder;
@Value("${security.facebook.enabled}") private String facebookEnabled;
@Value("${security.facebook.enabled}") private boolean facebookEnabled;
@Value("${security.facebook.enabled-roles:speaker,student}") private String[] facebookRoles;
@Value("${security.facebook.order}") private int facebookOrder;
@Value("${security.google.enabled}") private String googleEnabled;
@Value("${security.google.enabled}") private boolean googleEnabled;
@Value("${security.google.allowed-roles:speaker,student}") private String[] googleRoles;
@Value("${security.google.order}") private int googleOrder;
@Value("${security.twitter.enabled}") private String twitterEnabled;
@Value("${security.twitter.enabled}") private boolean twitterEnabled;
@Value("${security.twitter.allowed-roles:speaker,student}") private String[] twitterRoles;
@Value("${security.twitter.order}") private int twitterOrder;
......@@ -313,7 +313,7 @@ public class LoginController extends AbstractController {
/* The first parameter is replaced by the backend, the second one by the frondend */
String dialogUrl = apiPath + "/auth/dialog?type={0}&successurl='{0}'";
if ("true".equals(guestEnabled)) {
if (guestEnabled) {
ServiceDescription sdesc = new ServiceDescription(
"guest",
"Guest",
......@@ -324,7 +324,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(customLoginEnabled) && !"".equals(customLoginDialog)) {
if (customLoginEnabled && !"".equals(customLoginDialog)) {
ServiceDescription sdesc = new ServiceDescription(
"custom",
customLoginTitle,
......@@ -336,7 +336,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(dbAuthEnabled) && !"".equals(dbAuthDialog)) {
if (dbAuthEnabled && !"".equals(dbAuthDialog)) {
ServiceDescription sdesc = new ServiceDescription(
"arsnova",
dbAuthTitle,
......@@ -348,7 +348,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(ldapEnabled) && !"".equals(ldapDialog)) {
if (ldapEnabled && !"".equals(ldapDialog)) {
ServiceDescription sdesc = new ServiceDescription(
"ldap",
ldapTitle,
......@@ -360,7 +360,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(casEnabled)) {
if (casEnabled) {
ServiceDescription sdesc = new ServiceDescription(
"cas",
casTitle,
......@@ -371,7 +371,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(facebookEnabled)) {
if (facebookEnabled) {
ServiceDescription sdesc = new ServiceDescription(
"facebook",
"Facebook",
......@@ -382,7 +382,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(googleEnabled)) {
if (googleEnabled) {
ServiceDescription sdesc = new ServiceDescription(
"google",
"Google",
......@@ -393,7 +393,7 @@ public class LoginController extends AbstractController {
services.add(sdesc);
}
if ("true".equals(twitterEnabled)) {
if (twitterEnabled) {
ServiceDescription sdesc = new ServiceDescription(
"twitter",
"Twitter",
......
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