tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Upgrading Custom Realms from 4.0.6 to 4.1.18
Date Fri, 24 Jan 2003 05:28:53 GMT
The simplest is to just disable the JMX support Listeners.  Assuming that
you want to keep the 'admin' webapp, then all that you need to do is to
create an mbeans-descriptor.xml file looking like:
<?xml version="1.0"?>
<!DOCTYPE mbeans-descriptors PUBLIC
 "-//Apache Software Foundation//DTD Model MBeans Configuration File"
 "http://jakarta.apache.org/commons/dtds/mbeans-descriptors.dtd">

<mbeans-descriptors>
  <mbean         name="NewRealm"
            className="org.apache.catalina.mbeans.ClassNameMBean"
          description="My New Realm"
               domain="Catalina"
                group="Realm"
                 type="com.twt.security.action.login.NewRealm" />
</mbean-descriptors>

Package it in the jar with your Realm, and set the
descriptors="/com/twt/security/action/login/mbean-descriptor.xml" attribute
on the ServerLifecycleListener element in server.xml.

In the current release, you won't be able to modify your Realm in the admin
webapp, but at least it will stop throwing exceptions.

<KDavey@twt.com> wrote in message
news:OF2DF9FA1E.D05439A1-ON86256CB7.0056BFD1@twt.com...
> Not being an expert on JMX and MBeans, I am looking for a guide that will
> show me how to upgrade the custom realm that I have coded for version
> 4.0.6.  When I run it in 4.1.18 it complains about not being an mbean.
>
> I have used MBEans in JBoss, but that has been a while.  I am looking for
> something that will show me how to updgrade this class and get it
> configured for 4.1.18
>
> thanks
>
> package com.twt.security.action.login;
>
> import org.apache.catalina.*;
> import org.apache.catalina.realm.RealmBase;
>
> public final class NewRealm extends RealmBase{
>
>     Container container = null;
>
>     private final String REALM_NAME = "Realm";
>     private final String REALM_VERSION = "1.0";
>
>     private Vector propertyChangeListeners = new Vector();
>
>     private UserManageable loginUser(String userName, String password) {
>
> // GUts of the security check
>         return user;
>     }
>
>     public void addPropertyChangeListener(PropertyChangeListener
> propertyChangeListener) {
>         propertyChangeListeners.add(propertyChangeListener);
>     }
>
>     public Principal authenticate(String userName, String password) {
>
>         return this.loginUser(userName, password);
>     }
>
>     public Principal authenticate(String s, String s1, String s2, String
> s3, String s4, String s5, String s6, String s7) {
>         return null;
>     }
>
>     public Principal authenticate(String userName, byte[] password) {
>         return this.loginUser(userName, password.toString());
>     }
>
>     public Principal authenticate(X509Certificate[] x509Certificates) {
>         return null;
>     }
>
>     public Container getContainer() {
>         return this.getContainer();
>     }
>
>     public String getInfo() {
>         return this.REALM_NAME + "/" + this.REALM_VERSION;
>     }
>
>     public boolean hasRole(Principal principal, String role) {
>         UserManageable user = null;
>
>         if (principal instanceof UserManageable) {
>             user = (UserManageable) principal;
>
>             if (user.hasRole(role)) {
>                 return true;
>             }
>
>         }
>         return false;
>     }
>
>     public void removePropertyChangeListener(PropertyChangeListener
> propertyChangeListener) {
>         if (propertyChangeListeners.contains(propertyChangeListener)) {
>             propertyChangeListeners.remove(propertyChangeListener);
>         }
>     }
>
>     protected String getName() {
>         return null;
>     }
>
>     protected String getPassword(String s) {
>         return null;
>     }
>
>     protected Principal getPrincipal(String s) {
>         return null;
>     }
>
>     public void setContainer(Container container) {
>         this.container = container;
>     }
>
>
> }
> kmd
>
> Phone (608)273-8933 x2084
> Cell (608)358-2037




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message