merged
This commit is contained in:
parent
46bde679fe
commit
1988b1a30c
@ -1,8 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||||
<persistence-unit name="hsadmin" transaction-type="RESOURCE_LOCAL">
|
<persistence-unit name="hsadmin">
|
||||||
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
|
<jta-data-source>java:/comp/env/jdbc/HSAdminDB</jta-data-source>
|
||||||
<non-jta-data-source>java:/comp/env/jdbc/HSAdminDB</non-jta-data-source>
|
|
||||||
<class>de.hsadmin.core.qserv.QueueTask</class>
|
<class>de.hsadmin.core.qserv.QueueTask</class>
|
||||||
<class>de.hsadmin.mods.cust.Customer</class>
|
<class>de.hsadmin.mods.cust.Customer</class>
|
||||||
<class>de.hsadmin.mods.cust.Contact</class>
|
<class>de.hsadmin.mods.cust.Contact</class>
|
||||||
|
@ -2,9 +2,11 @@ package de.hsadmin.core.model;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.LocalBean;
|
||||||
|
import javax.ejb.Stateful;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import javax.persistence.PersistenceContextType;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import de.hsadmin.core.util.Config;
|
import de.hsadmin.core.util.Config;
|
||||||
@ -12,14 +14,16 @@ import de.hsadmin.mods.cust.Customer;
|
|||||||
import de.hsadmin.mods.pac.Pac;
|
import de.hsadmin.mods.pac.Pac;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@Stateless
|
@Stateful(name="LoginSession")
|
||||||
|
@LocalBean
|
||||||
public class LoginSession implements LoginSessionLocal {
|
public class LoginSession implements LoginSessionLocal {
|
||||||
|
|
||||||
@PersistenceContext(name="hsadmin")
|
@PersistenceContext(unitName="hsadmin",type=PersistenceContextType.TRANSACTION)
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
private String loginName;
|
private String loginName;
|
||||||
|
|
||||||
|
@Override
|
||||||
public UnixUser getLoginUser() {
|
public UnixUser getLoginUser() {
|
||||||
String loginName = getLoginName();
|
String loginName = getLoginName();
|
||||||
if (loginName != null && loginName.length() == 2) {
|
if (loginName != null && loginName.length() == 2) {
|
||||||
@ -34,6 +38,7 @@ public class LoginSession implements LoginSessionLocal {
|
|||||||
return unixUser;
|
return unixUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLoginName() {
|
public String getLoginName() {
|
||||||
if (loginName != null) {
|
if (loginName != null) {
|
||||||
return loginName;
|
return loginName;
|
||||||
@ -41,6 +46,7 @@ public class LoginSession implements LoginSessionLocal {
|
|||||||
throw new TechnicalException("no login");
|
throw new TechnicalException("no login");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean login(String user, String ticket) throws AuthenticationException {
|
public boolean login(String user, String ticket) throws AuthenticationException {
|
||||||
String ticketUser = TicketValidator.getInstance().validateTicket(ticket);
|
String ticketUser = TicketValidator.getInstance().validateTicket(ticket);
|
||||||
if (user != null && user.equals(ticketUser)) {
|
if (user != null && user.equals(ticketUser)) {
|
||||||
|
@ -5,12 +5,14 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.ejb.LocalBean;
|
||||||
import javax.ejb.Stateless;
|
import javax.ejb.Stateless;
|
||||||
|
|
||||||
import de.hsadmin.core.qserv.QueueTask;
|
import de.hsadmin.core.qserv.QueueTask;
|
||||||
|
|
||||||
@Stateless
|
@Stateless
|
||||||
public class QueueManager {
|
@LocalBean
|
||||||
|
public class QueueManager implements QueueManagerLocal {
|
||||||
|
|
||||||
private final Map<String, QueueTaskStore> taskStores;
|
private final Map<String, QueueTaskStore> taskStores;
|
||||||
|
|
||||||
@ -18,6 +20,10 @@ public class QueueManager {
|
|||||||
taskStores = new HashMap<String, QueueManager.QueueTaskStore>();
|
taskStores = new HashMap<String, QueueManager.QueueTaskStore>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see de.hsadmin.core.model.QueueManagerLocal#enqueue(java.lang.String, de.hsadmin.core.qserv.QueueTask)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public void enqueue(String hiveName, QueueTask task) {
|
public void enqueue(String hiveName, QueueTask task) {
|
||||||
QueueTaskStore taskStore = taskStores.get(hiveName);
|
QueueTaskStore taskStore = taskStores.get(hiveName);
|
||||||
if (taskStore == null) {
|
if (taskStore == null) {
|
||||||
|
@ -8,6 +8,8 @@ import java.net.MalformedURLException;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
|
||||||
|
import de.hsadmin.core.util.Config;
|
||||||
|
|
||||||
|
|
||||||
public class TicketValidator {
|
public class TicketValidator {
|
||||||
|
|
||||||
@ -24,12 +26,15 @@ public class TicketValidator {
|
|||||||
public static TicketValidator getInstance() {
|
public static TicketValidator getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
instance = new TicketValidator();
|
instance = new TicketValidator();
|
||||||
|
Config config = Config.getInstance();
|
||||||
|
String validateUrl = config.getProperty("proxyValidateUrl");
|
||||||
|
String serviceUrl = config.getProperty("proxyServiceUrl");
|
||||||
|
instance.initialize(validateUrl, serviceUrl);
|
||||||
}
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME wird nicht aufgerufen
|
private void initialize(String validateURL, String serviceURL) {
|
||||||
public void initialize(String validateURL, String serviceURL) {
|
|
||||||
proxyServiceURL = serviceURL;
|
proxyServiceURL = serviceURL;
|
||||||
proxyValidateURL = validateURL;
|
proxyValidateURL = validateURL;
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,19 @@ import java.util.HashMap;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Properties;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
|
|
||||||
import javax.ejb.EJB;
|
import javax.ejb.EJB;
|
||||||
|
import javax.naming.Context;
|
||||||
|
import javax.naming.InitialContext;
|
||||||
|
import javax.naming.NamingException;
|
||||||
|
|
||||||
import de.hsadmin.core.model.AbstractEntity;
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.core.model.AuthenticationException;
|
import de.hsadmin.core.model.AuthenticationException;
|
||||||
import de.hsadmin.core.model.AuthorisationException;
|
import de.hsadmin.core.model.AuthorisationException;
|
||||||
import de.hsadmin.core.model.HSAdminException;
|
import de.hsadmin.core.model.HSAdminException;
|
||||||
import de.hsadmin.core.model.LoginSession;
|
import de.hsadmin.core.model.LoginSessionLocal;
|
||||||
import de.hsadmin.mods.email.EMailAlias;
|
import de.hsadmin.mods.email.EMailAlias;
|
||||||
import de.hsadmin.mods.email.EMailAliasModuleImpl;
|
import de.hsadmin.mods.email.EMailAliasModuleImpl;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
@ -23,11 +27,24 @@ import de.hsadmin.mods.user.UnixUser;
|
|||||||
public class EMailAliasRemote {
|
public class EMailAliasRemote {
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
private LoginSession session;
|
private LoginSessionLocal session;
|
||||||
|
|
||||||
@EJB
|
@EJB
|
||||||
private EMailAliasModuleImpl module;
|
private EMailAliasModuleImpl module;
|
||||||
|
|
||||||
|
public EMailAliasRemote() {
|
||||||
|
Properties props = new Properties();
|
||||||
|
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.core.LocalInitialContextFactory");
|
||||||
|
Context ctx = null;
|
||||||
|
try {
|
||||||
|
ctx = new InitialContext(props);
|
||||||
|
session = (LoginSessionLocal) ctx.lookup("LoginSessionLocal");
|
||||||
|
module = (EMailAliasModuleImpl) ctx.lookup("EMailAliasModuleLocal");
|
||||||
|
} catch (NamingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> search(String runAsUser, String ticket,
|
public List<Map<String, Object>> search(String runAsUser, String ticket,
|
||||||
Map<String, String> whereParams) throws HSAdminException {
|
Map<String, String> whereParams) throws HSAdminException {
|
||||||
String user = runAsUser;
|
String user = runAsUser;
|
||||||
|
Loading…
Reference in New Issue
Block a user