SamSubsystem.getInstance().setUserContext( ( DirContext ) ctx, "ou=Users" );
SamSubsystem.getInstance().setUserContext( ctx, "ou=Users" );
    private void startKerberosProtocol( Hashtable env ) throws NamingException    {        /*         * Looks like KdcConfiguration takes properties and we use Hashtable for JNDI         * so I'm copying over the String based properties into a new Properties obj.         */        Properties props = new Properties();        Iterator list = env.keySet().iterator();        while ( list.hasNext() )        {            String key = ( String ) list.next();            if ( env.get( key ) instanceof String )            {                props.setProperty( key, ( String ) env.get( key ) );            }        }        // construct the configuration, get the port, create the service, and prepare kdc objects        KdcConfiguration config = new KdcConfiguration( props );        int port = PropertiesUtils.get( env, KdcConfiguration.KDC_PORT_KEY, KdcConfiguration.KDC_DEFAULT_PORT );        Service service= new Service( "kerberos", TransportType.DATAGRAM, new InetSocketAddress( port ) );        LdapContext ctx = getBaseRealmContext( config, env );        PrincipalStore store = new JndiPrincipalStoreImpl( ctx, new LdapName( "ou=Users" ) );        SamSubsystem.getInstance().setUserContext( ( DirContext ) ctx, "ou=Users" );        try        {            minaRegistry.bind( service, new KerberosProtocolProvider( config, store ) );            kerberosService = service;            if ( log.isInfoEnabled() )            {                log.info( "Successful bind of KRB5 Service completed: " + kerberosService );            }        }        catch ( IOException e )        {            log.error( "Could not start the kerberos service on port " +                        KdcConfiguration.KDC_DEFAULT_PORT, e );        }    }