|
Tomcat example source code file (UserDatabaseRealm.java)
The Tomcat UserDatabaseRealm.java source code
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (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.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.catalina.realm;
import java.security.Principal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.naming.Context;
import org.apache.catalina.Group;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.Role;
import org.apache.catalina.ServerFactory;
import org.apache.catalina.User;
import org.apache.catalina.UserDatabase;
import org.apache.catalina.core.StandardServer;
import org.apache.catalina.util.StringManager;
/**
* <p>Implementation of {@link org.apache.catalina.Realm} that is based on an implementation of
* {@link UserDatabase} made available through the global JNDI resources
* configured for this instance of Catalina. Set the <code>resourceName
* parameter to the global JNDI resources name for the configured instance
* of <code>UserDatabase that we should consult.
*
* @author Craig R. McClanahan
* @version $Revision: 543691 $ $Date: 2007-06-02 03:37:08 +0200 (sam., 02 juin 2007) $
* @since 4.1
*/
public class UserDatabaseRealm
extends RealmBase {
// ----------------------------------------------------- Instance Variables
/**
* The <code>UserDatabase we will use to authenticate users
* and identify associated roles.
*/
protected UserDatabase database = null;
/**
* Descriptive information about this Realm implementation.
*/
protected final String info =
"org.apache.catalina.realm.UserDatabaseRealm/1.0";
/**
* Descriptive information about this Realm implementation.
*/
protected static final String name = "UserDatabaseRealm";
/**
* The global JNDI name of the <code>UserDatabase resource
* we will be utilizing.
*/
protected String resourceName = "UserDatabase";
/**
* The string manager for this package.
*/
private static StringManager sm =
StringManager.getManager(Constants.Package);
// ------------------------------------------------------------- Properties
/**
* Return descriptive information about this Realm implementation and
* the corresponding version number, in the format
* <code><description>/<version>.
*/
public String getInfo() {
return info;
}
/**
* Return the global JNDI name of the <code>UserDatabase resource
* we will be using.
*/
public String getResourceName() {
return resourceName;
}
/**
* Set the global JNDI name of the <code>UserDatabase resource
* we will be using.
*
* @param resourceName The new global JNDI name
*/
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
// --------------------------------------------------------- Public Methods
/**
* Return <code>true if the specified Principal has the specified
* security role, within the context of this Realm; otherwise return
* <code>false. This implementation returns
Other Tomcat examples (source code examples)Here is a short list of links related to this Tomcat UserDatabaseRealm.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.