|
From: <gun...@us...> - 2007-09-04 08:31:15
|
Revision: 4948
http://dcm4che.svn.sourceforge.net/dcm4che/?rev=4948&view=rev
Author: gunterze
Date: 2007-09-04 01:31:07 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
[#DCMEE-505] DicomSecurityService: Perform JAAS login based on User Identity Negotiation and provide javax.security.auth.Subject as association property "user"
Modified Paths:
--------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-dcmsec-xmbean.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/deploy/dcm4chee-dcmsec-service.xml
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/DicomSecurityService.java
Removed Paths:
-------------
dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/AEServiceDelegate.java
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-dcmsec-xmbean.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-dcmsec-xmbean.xml 2007-09-04 07:41:27 UTC (rev 4947)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/conf/xmdesc/dcm4chee-dcmsec-xmbean.xml 2007-09-04 08:31:07 UTC (rev 4948)
@@ -84,13 +84,6 @@
</descriptors>
</attribute>
- <attribute access="read-write" getMethod="getEchoServiceName"
- setMethod="setAEServiceName">
- <description>Used internally. Do not modify.</description>
- <name>AEServiceName</name>
- <type>javax.management.ObjectName</type>
- </attribute>
-
&defaultAttributes;
<!-- Operations -->
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/deploy/dcm4chee-dcmsec-service.xml
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/deploy/dcm4chee-dcmsec-service.xml 2007-09-04 07:41:27 UTC (rev 4947)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/etc/deploy/dcm4chee-dcmsec-service.xml 2007-09-04 08:31:07 UTC (rev 4948)
@@ -6,7 +6,5 @@
<mbean code="org.dcm4chex.archive.mbean.DicomSecurityService"
name="dcm4chee.archive:service=DicomSecurity"
xmbean-dd="xmdesc/dcm4chee-dcmsec-xmbean.xml">
- <depends optional-attribute-name="AEServiceName"
- >dcm4chee.archive:service=AE</depends>
</mbean>
</server>
\ No newline at end of file
Deleted: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/AEServiceDelegate.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/AEServiceDelegate.java 2007-09-04 07:41:27 UTC (rev 4947)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/AEServiceDelegate.java 2007-09-04 08:31:07 UTC (rev 4948)
@@ -1,100 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is part of dcm4che, an implementation of DICOM(TM) in
- * Java(TM), hosted at http://sourceforge.net/projects/dcm4che.
- *
- * The Initial Developer of the Original Code is
- * Agfa-Gevaert N.V.
- * Portions created by the Initial Developer are Copyright (C) 2002-2005
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * See listed authors below.
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-package org.dcm4chex.archive.mbean;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.rmi.RemoteException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanException;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.net.ServerSocketFactory;
-
-import org.dcm4che2.audit.message.SecurityAlertMessage;
-import org.dcm4chex.archive.ejb.interfaces.AEDTO;
-import org.dcm4chex.archive.ejb.interfaces.AEManager;
-import org.dcm4chex.archive.exceptions.ConfigurationException;
-import org.dcm4chex.archive.exceptions.UnknownAETException;
-import org.jboss.system.ServiceMBeanSupport;
-
-/**
- * @author Gunter Zeilinger <gun...@gm...>
- * @version $Revision$ $Date$
- * @since Aug 24, 2007
- */
-public class AEServiceDelegate {
-
- private final ServiceMBeanSupport service;
- private ObjectName aeServiceName;
-
- public AEServiceDelegate(final ServiceMBeanSupport service) {
- this.service = service;
- }
-
- public final ObjectName getAEServiceName() {
- return aeServiceName;
- }
-
- public final void setAEServiceName(ObjectName aeServiceName) {
- this.aeServiceName = aeServiceName;
- }
-
- public AEDTO getAE(String title) throws UnknownAETException {
- try {
- return (AEDTO) service.getServer().invoke(
- aeServiceName, "getAE", new Object[] { title },
- new String[] { String.class.getName() });
- } catch (InstanceNotFoundException e) {
- throw new ConfigurationException(e);
- } catch (MBeanException e) {
- Throwable cause = e.getCause();
- if (cause instanceof UnknownAETException) {
- throw (UnknownAETException) cause;
- }
- throw new ConfigurationException(e);
- } catch (ReflectionException e) {
- throw new ConfigurationException(e);
- }
- }
-}
Modified: dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/DicomSecurityService.java
===================================================================
--- dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/DicomSecurityService.java 2007-09-04 07:41:27 UTC (rev 4947)
+++ dcm4chee/dcm4chee-arc/trunk/dcm4jboss-sar/src/java/org/dcm4chex/archive/mbean/DicomSecurityService.java 2007-09-04 08:31:07 UTC (rev 4948)
@@ -37,7 +37,6 @@
* ***** END LICENSE BLOCK ***** */
package org.dcm4chex.archive.mbean;
-import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.security.auth.Subject;
@@ -51,8 +50,11 @@
import org.dcm4che.net.UserIdentityNegotiator;
import org.dcm4che.net.UserIdentityRQ;
import org.dcm4chex.archive.ejb.interfaces.AEDTO;
+import org.dcm4chex.archive.ejb.interfaces.AEManager;
+import org.dcm4chex.archive.ejb.interfaces.AEManagerHome;
import org.dcm4chex.archive.exceptions.ConfigurationException;
import org.dcm4chex.archive.exceptions.UnknownAETException;
+import org.dcm4chex.archive.util.EJBHomeFactory;
import org.jboss.security.SimplePrincipal;
import org.jboss.security.plugins.JaasSecurityManager;
import org.jboss.system.ServiceMBeanSupport;
@@ -65,7 +67,6 @@
public class DicomSecurityService extends ServiceMBeanSupport
implements UserIdentityNegotiator {
- private AEServiceDelegate aeService = new AEServiceDelegate(this);
private JaasSecurityManager securityManager;
private String securityDomain;
private String defUserID;
@@ -119,14 +120,6 @@
this.defPassword = nullify(defPassword, "-");
}
- public final ObjectName getAEServiceName() {
- return aeService.getAEServiceName();
- }
-
- public final void setAEServiceName(ObjectName aeServiceName) {
- aeService.setAEServiceName(aeServiceName);
- }
-
protected void startService() throws Exception {
initSecurityManager();
}
@@ -145,8 +138,7 @@
iniCtx.close();
} catch (NamingException ignore) {}
}
- }
-
+ }
}
public UserIdentityNegotiator userIdentityNegotiator() {
@@ -164,10 +156,13 @@
passwd = uidRQ.getPasscode();
} else {
try {
- AEDTO ae = aeService.getAE(rq.getCallingAET());
+ AEDTO ae = aeMgr().findByAET(rq.getCallingAET());
userId = ae.getUserID();
passwd = ae.getPassword();
- } catch (UnknownAETException e) {}
+ } catch (UnknownAETException e) {
+ } catch (Exception e) {
+ throw new ConfigurationException(e);
+ }
if (userId == null || userId.length() == 0) {
if (rejectIfNoUserIdentity) {
throw new AAssociateRJException(
@@ -195,4 +190,9 @@
? AssociationFactory.getInstance().newUserIdentity() : null;
}
+ private AEManager aeMgr() throws Exception {
+ AEManagerHome home = (AEManagerHome) EJBHomeFactory.getFactory()
+ .lookup(AEManagerHome.class, AEManagerHome.JNDI_NAME);
+ return home.create();
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|