changed: README.MD
updated: MDMLoginModule (ConnectorService lookup)
diff --git a/README.md b/README.md
index 7800c24..7ca79ff 100644
--- a/README.md
+++ b/README.md
@@ -1,43 +1,48 @@
- Copyright (c) 2016 Gigatronik Ingolstadt GmbH
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
+<!--
+Copyright (c) 2016 Gigatronik Ingolstadt GmbH
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+-->
- <h3>available realms</h3>
- <h5>glassfish login realm: org.eclipse.mdm.realm.login.glassfish</h5>
+## available realms
+
+## 1. Glassfish Login Realm (org.eclipse.mdm.realm.login.glassfish)
+
+Before you can install and build the realm, you have to checkout and install: (gradlew install)
+* org.eclipse.mdm.api.base
+* org.eclipse.mdm.api.odsadapter
+* org.eclipse.mdm.nucleus (see also README.md)
+
+The command 'gradlew installRealm' at org.eclipse.mdm.realms/org.eclipse.mdm.realm.login.glassfish creates the jar file for this login module.
+
+The jar file will be generated at **org.eclipse.mdm.realms/org.eclipse.mdm.realm.login.glassfish/build/libs/org.eclipse.mdm.realm.login.glassfish-1.0.0.jar**
+
+1. **Install MDM Login Realm plugin at Glassfish**
+
+* **copy** the jar file **org.eclipse.mdm.realm.login.glassfish-1.0.0.jar** to **GLASSFISH4_ROOT/glassfish/domains/domain1/lib**
-- build:
- The command 'gradlew installRealm' creates the jar file for this login module.
- The jar file will be generated at org.eclipse.mdm.realms/org.eclipse.mdm.realm.login.glassfish/build/libs/org.eclipse.mdm.realm.login.glassfish-1.0.0.jar
- <br>
- <b>install login realm plugin at glassfish:</b>
- <ul>
- <li>copy the jar file org.eclipse.mdm.realm.login.glassfish-1.0.0.jar to GLASSFISH4_ROOT/glassfish/domains/domain1/lib</li>
- <li>open the glassfish login configuration file GLASSFISH4_ROOT/glassfish/domains/domain1/config/login.conf</li>
- <li>
- add MDM realm module entry to this config file
- <code>
- MDMLoginRealm {
- org.eclipse.mdm.realm.login.glassfish.LoginRealmModule required;
- };
- </code>
- </li>
- <li>start glassfish GLASSFISH4_ROOT/glassfish/bin/startserv.bat</li>
- <li>open glassfish server admin console e.g. at localhost:4848 (default)</li>
- <li>open site: Configurations/server-config/Security/Realms</li>
- <li>create new realm ("New" Button)
- <code>
- <b>Name:</b> <b><i>MDMLoginRealm</i></b> (realm-name defined at web.xml at org.eclipse.mdm.application/src/main/configuration)
- <b>Class Name:</b> <b><i>org.eclipse.mdm.realm.login.glassfish.LoginRealm</i></b> (choose a specific class name (radio button))
- add Property:
- <b>Name:</b> <b><i>jaas-context</i></b>
- <b>Value:</b> <b><i>MDMLoginRealm</i></b> (name defined at glassfish login.conf)
- </code>
- </li>
- <li>open site: Configurations/server-config/Virtual Servers</li>
- <li>choose server and enable SSO (Value: Enabled)</li>
- <li>save restart the glassfish application server</li>
-
-
-
\ No newline at end of file
+* **open** the Glassfish login **configuration file** at **GLASSFISH4_ROOT/glassfish/domains/domain1/config/login.conf**
+
+* **add** MDM realm module entry to this config file
+
+ MDMLoginRealm {
+ org.eclipse.mdm.realm.login.glassfish.LoginRealmModule required;
+ };
+
+* **start** Glassfish and **open administration website** (e.g. localhost:4848)
+
+* **open site**: Configurations/server-config/Security/Realms
+
+* **create** new **realm** ("New" Button)
+
+ **Name:** MDMLoginRealm, **Class Name:** org.eclipse.mdm.realm.login.glassfish.LoginRealm _(choose a specific class name (with radio button))_
+
+ **add Property:** **Name:** jaas-context, **Value:** MDMLoginRealm
+
+* **open site**: Configurations/server-config/Virtual Servers
+
+* **choose** server and **enable SSO** (Value: Enabled)
+
+* **save and restart** the Glassfish application server
\ No newline at end of file
diff --git a/org.eclipse.mdm.realm.login.glassfish/.gitignore b/org.eclipse.mdm.realm.login.glassfish/.gitignore
new file mode 100644
index 0000000..49678ad
--- /dev/null
+++ b/org.eclipse.mdm.realm.login.glassfish/.gitignore
@@ -0,0 +1,17 @@
+# eclipse
+.classpath
+.project
+.settings/
+bin/
+
+# gradle
+.gradle
+build/
+
+# intellij
+.idea/
+out/
+*.ipr
+*.iml
+*.iws
+/bin/
diff --git a/org.eclipse.mdm.realm.login.glassfish/build.gradle b/org.eclipse.mdm.realm.login.glassfish/build.gradle
index 4ffc83d..228266c 100644
--- a/org.eclipse.mdm.realm.login.glassfish/build.gradle
+++ b/org.eclipse.mdm.realm.login.glassfish/build.gradle
@@ -9,11 +9,10 @@
* Sebastian Dirsch - initial configuration
*******************************************************************************/
-description = 'MDM I18N'
+description = 'glassfish username/password login realm implementation'
group = 'org.eclipse.mdm'
version = '1.0.0'
apply plugin: 'java'
-apply plugin: 'eclipse'
apply plugin: 'maven'
sourceCompatibility = 1.8
targetCompatibility = 1.8
@@ -35,22 +34,18 @@
compile 'javax:javaee-api:7.0'
- compile 'org.eclipse.mdm:org.eclipse.mdm.api.base:1.0.0'
+ compile 'org.eclipse.mdm:org.eclipse.mdm.api.base:1.0.0'
compile 'org.eclipse.mdm:org.eclipse.mdm.connector:1.0.0'
-
- compile 'org.glassfish.main.deployment:deployment-common:4.1.1'
- compile 'org.glassfish.main.security:security:4.1.1'
- compile 'org.glassfish.main.common:glassfish-ee-api:4.1.1'
+
+ compile 'org.glassfish.main.common:glassfish-ee-api:4.1.1'
- testCompile 'org.mockito:mockito-core:1.+'
- testCompile 'junit:junit:4.12'
}
task installRealm(type: Jar) {
manifest.from jar.manifest
from {
- configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
+ configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) }
}
with jar
diff --git a/org.eclipse.mdm.realm.login.glassfish/src/main/java/org/eclipse/mdm/realm/login/glassfish/LoginRealmModule.java b/org.eclipse.mdm.realm.login.glassfish/src/main/java/org/eclipse/mdm/realm/login/glassfish/LoginRealmModule.java
index 47817f9..f3b5d98 100644
--- a/org.eclipse.mdm.realm.login.glassfish/src/main/java/org/eclipse/mdm/realm/login/glassfish/LoginRealmModule.java
+++ b/org.eclipse.mdm.realm.login.glassfish/src/main/java/org/eclipse/mdm/realm/login/glassfish/LoginRealmModule.java
@@ -24,8 +24,7 @@
import javax.security.auth.spi.LoginModule;
import org.eclipse.mdm.api.base.EntityManager;
-import org.eclipse.mdm.connector.ConnectorBeanLI;
-import org.eclipse.mdm.connector.ConnectorException;
+import org.eclipse.mdm.connector.boundary.ConnectorService;
import org.glassfish.internal.api.Globals;
import org.glassfish.security.common.Group;
@@ -40,8 +39,6 @@
*
*/
public class LoginRealmModule implements LoginModule {
-
-
private final static String MDM_GROUP = "MDM";
@@ -56,7 +53,7 @@
private boolean phase1Succeeded = false;
private boolean phase2Succeeded = false;
- private ConnectorBeanLI connectorBean;
+ private ConnectorService connectorService;
private List<EntityManager> emList;
@@ -64,7 +61,6 @@
@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState,
Map<String, ?> options) {
-
this.subject = subject;
}
@@ -73,19 +69,18 @@
@Override
public boolean login() throws LoginException {
try {
-
PasswordCredential passwordCredential = lookupPasswordCredential(this.subject);
this.realm = passwordCredential.getRealm();
this.username = passwordCredential.getUser();
this.password = String.valueOf(passwordCredential.getPassword());
- ConnectorBeanLI connector = getConnector();
+ ConnectorService connector = getConnector();
this.emList = connector.connect(this.username, this.password);
this.phase1Succeeded = true;
- } catch(ConnectorException e) {
+ } catch(RuntimeException e) {
throw new LoginException(e.getMessage());
}
return true;
@@ -119,7 +114,7 @@
principalSet.add(this.group);
}
- ConnectorBeanLI connector = getConnector();
+ ConnectorService connector = getConnector();
connector.registerConnections(this.principal, this.emList);
this.phase2Succeeded = true;
@@ -128,7 +123,7 @@
}
return true;
- } catch(ConnectorException e) {
+ } catch(RuntimeException e) {
throw new LoginException(e.getMessage());
} finally {
this.username = null;
@@ -161,8 +156,8 @@
@Override
public boolean logout() throws LoginException {
- ConnectorBeanLI connectorBean = getConnector();
- connectorBean.disconnect(this.principal);
+ ConnectorService connectorService = getConnector();
+ connectorService.disconnect(this.principal);
this.emList.clear();
@@ -217,16 +212,18 @@
- private ConnectorBeanLI getConnector() throws LoginException {
+ private ConnectorService getConnector() throws LoginException {
try {
- if(this.connectorBean == null) {
- String JNDIName = "java:global/org.eclipse.mdm.application-1.0.0/ConnectorBean!org.eclipse.mdm.connector.ConnectorBeanLI";
+ if(this.connectorService == null) {
+ String JNDIName = "java:global/org.eclipse.mdm.nucleus/ConnectorService!org.eclipse.mdm.connector.boundary.ConnectorService";
InitialContext initialContext = new InitialContext();
- this.connectorBean = (ConnectorBeanLI) initialContext.lookup(JNDIName);
+ this.connectorService = (ConnectorService) initialContext.lookup(JNDIName);
}
- return this.connectorBean;
+ return this.connectorService;
} catch(NamingException e) {
throw new LoginException(e.getMessage());
}
}
+
+
}