From 06c7edd2fb93416c14b03dd0550de52a9d4fae85 Mon Sep 17 00:00:00 2001 From: Daniel Gerhardt <daniel.gerhardt@mni.thm.de> Date: Wed, 7 May 2014 16:15:45 +0200 Subject: [PATCH] Add id attribute to ServiceDescription an make its name configurable --- .../arsnova/controller/LoginController.java | 19 ++++++++++++++++--- .../arsnova/entities/ServiceDescription.java | 17 +++++++++++++---- src/main/webapp/arsnova.properties.example | 3 +++ src/test/resources/arsnova.properties.example | 3 +++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/thm/arsnova/controller/LoginController.java b/src/main/java/de/thm/arsnova/controller/LoginController.java index 90f2edc6..20700681 100644 --- a/src/main/java/de/thm/arsnova/controller/LoginController.java +++ b/src/main/java/de/thm/arsnova/controller/LoginController.java @@ -78,10 +78,16 @@ public class LoginController extends AbstractController { private String guestLecturerEnabled; @Value("${security.user-db.enabled}") private String dbAuthEnabled; + @Value("${security.user-db.title:ARSnova}") + private String dbAuthTitle; @Value("${security.ldap.enabled}") private String ldapEnabled; + @Value("${security.ldap.title:LDAP}") + private String ldapTitle; @Value("${security.cas.enabled}") private String casEnabled; + @Value("${security.cas.title:CAS}") + private String casTitle; @Value("${security.facebook.enabled}") private String facebookEnabled; @Value("${security.google.enabled}") @@ -262,6 +268,7 @@ public class LoginController extends AbstractController { if ("true".equals(guestEnabled)) { ServiceDescription sdesc = new ServiceDescription( + "guest", "Guest", null ); @@ -273,14 +280,16 @@ public class LoginController extends AbstractController { if ("true".equals(dbAuthEnabled)) { services.add(new ServiceDescription( - "ARSnova", + "arsnova", + dbAuthTitle, null )); } if ("true".equals(ldapEnabled)) { services.add(new ServiceDescription( - "LDAP", + "ldap", + ldapTitle, null )); } @@ -288,7 +297,8 @@ public class LoginController extends AbstractController { if ("true".equals(casEnabled)) { try { services.add(new ServiceDescription( - "CAS", + "cas", + casTitle, casEntryPoint.getLoginUrl() + "?" + casEntryPoint.getServiceProperties().getServiceParameter() + "=" + URLEncoder.encode(casEntryPoint.getServiceProperties().getService(), "UTF-8") @@ -301,6 +311,7 @@ public class LoginController extends AbstractController { if ("true".equals(facebookEnabled)) { services.add(new ServiceDescription( + "facebook", "Facebook", facebookProvider.getAuthorizationUrl(new HttpUserSession(request)) )); @@ -308,6 +319,7 @@ public class LoginController extends AbstractController { if ("true".equals(googleEnabled)) { services.add(new ServiceDescription( + "google", "Google", googleProvider.getAuthorizationUrl(new HttpUserSession(request)) )); @@ -315,6 +327,7 @@ public class LoginController extends AbstractController { if ("true".equals(twitterEnabled)) { services.add(new ServiceDescription( + "twitter", "Twitter", twitterProvider.getAuthorizationUrl(new HttpUserSession(request)) )); diff --git a/src/main/java/de/thm/arsnova/entities/ServiceDescription.java b/src/main/java/de/thm/arsnova/entities/ServiceDescription.java index 2cc6bfab..01cd8b3b 100644 --- a/src/main/java/de/thm/arsnova/entities/ServiceDescription.java +++ b/src/main/java/de/thm/arsnova/entities/ServiceDescription.java @@ -1,22 +1,32 @@ package de.thm.arsnova.entities; public class ServiceDescription { - + private String id; private String name; private String dialogUrl; private boolean allowLecturer = true; - public ServiceDescription(String name, String dialogUrl) { + public ServiceDescription(String id, String name, String dialogUrl) { + this.id = id; this.name = name; this.dialogUrl = dialogUrl; } - public ServiceDescription(String name, String dialogUrl, boolean allowLecturer) { + public ServiceDescription(String id, String name, String dialogUrl, boolean allowLecturer) { + this.id = id; this.name = name; this.dialogUrl = dialogUrl; this.allowLecturer = allowLecturer; } + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public String getName() { return name; } @@ -40,5 +50,4 @@ public class ServiceDescription { public void setAllowLecturer(boolean allowLecturer) { this.allowLecturer = allowLecturer; } - } diff --git a/src/main/webapp/arsnova.properties.example b/src/main/webapp/arsnova.properties.example index 1b76bfb8..9ec7ff3a 100644 --- a/src/main/webapp/arsnova.properties.example +++ b/src/main/webapp/arsnova.properties.example @@ -5,17 +5,20 @@ security.guest.enabled=true security.guest.lecturer.enabled=true security.user-db.enabled=true +security.user-db.title=ARSnova security.user-db.allowed-email-domains=* security.user-db.registration-mail.subject=ARSnova Registration security.user-db.registration-mail.body=Welcome to ARSnova!\n\nPlease confirm your registration by visiting the following web address:\n{0}\n\nAfterwards, you can log into ARSnova with your e-mail address and password. security.ldap.enabled=true +security.ldap.title=LDAP security.ldap.url=ldap://example.com:33389/dc=example,dc=com security.ldap.user-dn-pattern=uid={0},ou=arsnova security.ldap.user-search-filter=(uid={0}) security.ldap.user-search-base="ou=people" security.cas.enabled=true +security.cas.title=CAS security.cas-server-url=https://cas.thm.de/cas security.facebook.enabled=true diff --git a/src/test/resources/arsnova.properties.example b/src/test/resources/arsnova.properties.example index 1b76bfb8..9ec7ff3a 100644 --- a/src/test/resources/arsnova.properties.example +++ b/src/test/resources/arsnova.properties.example @@ -5,17 +5,20 @@ security.guest.enabled=true security.guest.lecturer.enabled=true security.user-db.enabled=true +security.user-db.title=ARSnova security.user-db.allowed-email-domains=* security.user-db.registration-mail.subject=ARSnova Registration security.user-db.registration-mail.body=Welcome to ARSnova!\n\nPlease confirm your registration by visiting the following web address:\n{0}\n\nAfterwards, you can log into ARSnova with your e-mail address and password. security.ldap.enabled=true +security.ldap.title=LDAP security.ldap.url=ldap://example.com:33389/dc=example,dc=com security.ldap.user-dn-pattern=uid={0},ou=arsnova security.ldap.user-search-filter=(uid={0}) security.ldap.user-search-base="ou=people" security.cas.enabled=true +security.cas.title=CAS security.cas-server-url=https://cas.thm.de/cas security.facebook.enabled=true -- GitLab