mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-23 06:06:11 +00:00
added security.properties in Jetty config directory, next to security.properties, for e-mail validation configuration
This commit is contained in:
+1
-1
@@ -386,7 +386,7 @@ public class AdminConsoleEntryPoint extends AbstractEntryPoint implements Regatt
|
||||
boolean result = true;
|
||||
UserDTO user = getUserService().getCurrentUser();
|
||||
for (UserRoles enabledRole : roles) {
|
||||
if (user.getRoles().contains(enabledRole.name())) {
|
||||
if (user.hasRole(enabledRole.name())) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -58,5 +58,6 @@
|
||||
<servlet-name>remoteLogging</servlet-name>
|
||||
<url-pattern>/com.sap.sse.security.ui.OAuthLogin/remote_logging</url-pattern>
|
||||
<url-pattern>/com.sap.sse.security.ui.Login/remote_logging</url-pattern>
|
||||
<url-pattern>/com.sap.sse.security.ui.UserManagement/remote_logging</url-pattern>
|
||||
</servlet-mapping>
|
||||
</web-app>
|
||||
|
||||
+4
-1
@@ -83,7 +83,10 @@ public class RolesList extends DecoratorPanel {
|
||||
hp.add(addRole);
|
||||
fp.add(hp);
|
||||
|
||||
rolesDataProvider = new ListDataProvider<>(userDTO.getRoles(), keyProvider);
|
||||
rolesDataProvider = new ListDataProvider<String>();
|
||||
for (String role : userDTO.getRoles()) {
|
||||
rolesDataProvider.getList().add(role);
|
||||
}
|
||||
roleList = new CellList<>(new TextCell(), keyProvider);
|
||||
rolesDataProvider.addDataDisplay(roleList);
|
||||
|
||||
|
||||
+8
-3
@@ -1,8 +1,9 @@
|
||||
package com.sap.sse.security.ui.shared;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
@@ -10,7 +11,7 @@ public class UserDTO implements IsSerializable {
|
||||
private String name;
|
||||
private String email;
|
||||
private List<AccountDTO> accounts;
|
||||
private List<String> roles = new ArrayList<>();
|
||||
private Set<String> roles = new HashSet<>();
|
||||
|
||||
UserDTO() {} // for serialization only
|
||||
|
||||
@@ -28,9 +29,13 @@ public class UserDTO implements IsSerializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<String> getRoles() {
|
||||
public Iterable<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public boolean hasRole(String role) {
|
||||
return roles.contains(role);
|
||||
}
|
||||
|
||||
public void addRoles(Collection<String> roles) {
|
||||
this.roles.addAll(roles);
|
||||
|
||||
+3
-1
@@ -80,7 +80,9 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
DBObject accountsMap = (DBObject) userDBObject.get(FieldNames.User.ACCOUNTS.name());
|
||||
Map<AccountType, Account> accounts = createAccountMapFromdDBObject(accountsMap);
|
||||
User result = new User(name, email, accounts.values());
|
||||
result.setRoles(roles);
|
||||
for (String role : roles) {
|
||||
result.addRole(role);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+27
-32
@@ -10,26 +10,24 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.sap.sse.security.userstore.shared.Account.AccountType;
|
||||
|
||||
public class User {
|
||||
|
||||
|
||||
private String name;
|
||||
|
||||
|
||||
private String email;
|
||||
|
||||
private Set<String> roles = new HashSet<>();
|
||||
private Map<AccountType, Account> accounts = new ConcurrentHashMap<>();
|
||||
|
||||
private final Set<String> roles;
|
||||
private final Map<AccountType, Account> accounts;
|
||||
|
||||
public User(String name, String email, Account... accounts) {
|
||||
super();
|
||||
this.name = name;
|
||||
for (Account a : accounts){
|
||||
this.accounts.put(a.getAccountType(), a);
|
||||
}
|
||||
this(name, email, Arrays.asList(accounts));
|
||||
}
|
||||
|
||||
|
||||
public User(String name, String email, Collection<Account> accounts) {
|
||||
super();
|
||||
this.roles = new HashSet<>();
|
||||
this.accounts = new ConcurrentHashMap<>();
|
||||
this.name = name;
|
||||
for (Account a : accounts){
|
||||
for (Account a : accounts) {
|
||||
this.accounts.put(a.getAccountType(), a);
|
||||
}
|
||||
}
|
||||
@@ -41,39 +39,35 @@ public class User {
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public Set<String> getRoles() {
|
||||
return roles;
|
||||
}
|
||||
|
||||
public void addRole(String role){
|
||||
|
||||
public void addRole(String role) {
|
||||
roles.add(role);
|
||||
}
|
||||
|
||||
public boolean hasRole(String role) {
|
||||
return roles.contains(role);
|
||||
}
|
||||
|
||||
public void removeRole(String role){
|
||||
public void removeRole(String role) {
|
||||
roles.remove(role);
|
||||
}
|
||||
|
||||
public Account getAccount(AccountType type){
|
||||
|
||||
public Account getAccount(AccountType type) {
|
||||
return accounts.get(type);
|
||||
}
|
||||
|
||||
public void setAccount(AccountType type, Account account){
|
||||
accounts.put(type, account);
|
||||
}
|
||||
|
||||
public void removeAccount(AccountType type){
|
||||
|
||||
public void removeAccount(AccountType type) {
|
||||
accounts.remove(type);
|
||||
}
|
||||
|
||||
public Map<AccountType, Account> getAllAccounts(){
|
||||
public Map<AccountType, Account> getAllAccounts() {
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public void setRoles(Set<String> roles) {
|
||||
this.roles = roles;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
@@ -84,8 +78,9 @@ public class User {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "User [name=" + name + ", email=" + email + ", roles=" + Arrays.toString(roles.toArray(new String[roles.size()])) + ", accounts=" + Arrays.toString(accounts.keySet().toArray(new AccountType[accounts.size()])) + "]";
|
||||
return "User [name=" + name + ", email=" + email + ", roles="
|
||||
+ Arrays.toString(roles.toArray(new String[roles.size()])) + ", accounts="
|
||||
+ Arrays.toString(accounts.keySet().toArray(new AccountType[accounts.size()])) + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.sap.sse.security;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -27,6 +30,8 @@ public class Activator implements BundleActivator {
|
||||
*/
|
||||
private static UserStore testUserStore;
|
||||
|
||||
private Properties mailProperties;
|
||||
|
||||
public static void setTestUserStore(UserStore theTestUserStore) {
|
||||
testUserStore = theTestUserStore;
|
||||
UsernamePasswordRealm.setTestUserStore(theTestUserStore);
|
||||
@@ -47,6 +52,11 @@ public class Activator implements BundleActivator {
|
||||
* registered as an OSGi service.
|
||||
*/
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
// Load mail properties
|
||||
File propertiesfile = new File(new File(System.getProperty("jetty.home")).getParent()
|
||||
+ "/security.properties");
|
||||
mailProperties = new Properties();
|
||||
mailProperties.load(new FileReader(propertiesfile));
|
||||
if (testUserStore != null) {
|
||||
createAndRegisterSecurityService(testUserStore);
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ monitor.bundles = com.sap.sailing.gwt.ui, com.sap.sailing.server.gateway, com.sa
|
||||
|
||||
# mail configuration
|
||||
mail.enabled = false
|
||||
mail.from = info@sapsailing.com
|
||||
mail.from = noreply@sapsailing.com
|
||||
mail.to = axel.uhl@sap.com, axel.uhl@gmx.de, fmittag@gmx.net, spamsch@gmail.com
|
||||
mail.transport.protocol = smtp
|
||||
mail.smtp.host = 127.0.0.1
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# mail configuration, e.g., for password recovery
|
||||
mail.enabled = false
|
||||
mail.from = noreply@sapsailing.com
|
||||
mail.transport.protocol = smtp
|
||||
mail.smtp.host = 127.0.0.1
|
||||
mail.smtp.port = 25
|
||||
mail.smtp.auth = true
|
||||
mail.smtp.user =
|
||||
mail.smtp.password =
|
||||
Reference in New Issue
Block a user