001    /*
002     * Copyright 2006 Stephen McConnell.
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package net.dpml.http;
017    
018    import java.net.URI;
019    
020    /**
021     * Hash user realm with enhanced keystore resolution semantics.
022     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
023     * @version 0.0.4
024     */
025    public class HashUserRealm extends org.mortbay.jetty.security.HashUserRealm
026    {
027       /**
028        * HTTP Context handler context defintion.
029        */
030        public interface Context
031        {
032           /**
033            * Get the user realm name.
034            *
035            * @return the realm name
036            */
037            String getName();
038            
039           /**
040            * Return a uri of the real configuration properties file.
041            *
042            * @return the realm configuration uri
043            */
044            URI getURI();
045        }
046    
047       /**
048        * Creation of a new hash user realm.
049        * @param context the deployment context
050        * @exception Exception if an instantiation error occurs
051        */
052        public HashUserRealm( Context context ) throws Exception
053        {
054            String name = context.getName();
055            super.setName( name );
056            URI config = context.getURI();
057            setConfig( config.toASCIIString() );
058        }
059    }