Package org.apache.directory.server.core

Examples of org.apache.directory.server.core.LdapPrincipal


     */
    @Test
    public void testLdifSearchExistingEntry() throws Exception
    {
        DN adminDn = new DN( "uid=admin,ou=system" ).normalize( schemaManager.getNormalizerMapping() );
        CoreSession session = new MockCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), new MockDirectoryService( 1 ) );
        AddOperationContext addCtx = new AddOperationContext( session );
       
        ClonedServerEntry entry1 = createEntry( "dc=test,ou=test,ou=system" );
        entry1.put( "ObjectClass", "top", "domain" );
        entry1.put( "dc", "test" );
View Full Code Here


   
    private CoreSession injectEntries() throws Exception
    {
        DN adminDn = new DN( "uid=admin,ou=system" ).normalize( schemaManager.getNormalizerMapping() );
        CoreSession session = new MockCoreSession( new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), new MockDirectoryService( 1 ) );
        AddOperationContext addCtx = new AddOperationContext( session );
       
        ClonedServerEntry rootEntry = createEntry( "ou=test,ou=system" );
        rootEntry.put( "ObjectClass", "top", "domain" );
        rootEntry.put( "ou", "test" );
View Full Code Here

            .getLdapServer().getSearchBaseDn() ) );
        String bindDn = entry.getDistinguishedName();

        LOG.debug( "Converted username {} to DN {}.", username, bindDn );

        LdapPrincipal ldapPrincipal = new LdapPrincipal( new DN( entry.getDistinguishedName() ),
            AuthenticationLevel.STRONG, StringTools.EMPTY_BYTES );
        ldapSession.putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
        ldapSession.putSaslProperty( Context.SECURITY_PRINCIPAL, bindDn );

        authorizeCB.setAuthorizedID( bindDn );
View Full Code Here

                try
                {
                    result = provider.authenticate( getLdapSession().getIoSession(), response );
                    DN dn = getBindRequest().getName();
                    dn.normalize( getLdapSession().getLdapServer().getDirectoryService().getSchemaManager().getNormalizerMapping() );
                    LdapPrincipal ldapPrincipal = new LdapPrincipal( dn, AuthenticationLevel.STRONG );
                    getLdapSession().putSaslProperty( SaslConstants.SASL_AUTHENT_USER, ldapPrincipal );
                    getLdapSession().putSaslProperty( Context.SECURITY_PRINCIPAL, getBindRequest().getName().toString() );
                }
                catch ( Exception e )
                {
View Full Code Here

        requestor.getIoSession().write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );

        PartitionNexus nexus = service.getPartitionNexus();
        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( service.getSchemaManager().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( adminDn, AuthenticationLevel.STRONG );
        CoreSession session = service.getSession( principal );
        Set<String> suffixes = nexus.listSuffixes( new ListSuffixOperationContext( session ) );
        int launchedWindowCount = 0;
           
        for ( String suffix:suffixes )
View Full Code Here

     * to strong and return an {@link LdapPrincipal}.
     */
    public LdapPrincipal authenticate( BindOperationContext opContext ) throws NamingException
    {
        // Possibly check if user account is disabled, other account checks.
        return new LdapPrincipal( opContext.getDn(), AuthenticationLevel.STRONG );
    }
View Full Code Here

            LOG.debug( "Nexus succeeded on bind operation." );

            // bind succeeded if we got this far
            // TODO - authentication level not being set
            LdapPrincipal principal = new LdapPrincipal( opContext.getDn(), AuthenticationLevel.SIMPLE );
            CoreSession session = new DefaultCoreSession( principal, directoryService );
            opContext.setSession( session );

            // remove creds so there is no security risk
            opContext.setCredentials( null );
            return;
        }

        // TODO : we should refactor that.
        // try each authenticator
        for ( Authenticator authenticator : authenticators )
        {
            try
            {
                // perform the authentication
                LdapPrincipal principal = authenticator.authenticate( opContext );
               
                LdapPrincipal clonedPrincipal = (LdapPrincipal)(principal.clone());

                // remove creds so there is no security risk
                opContext.setCredentials( null );
                clonedPrincipal.setUserPassword( StringTools.EMPTY_BYTES );

                // authentication was successful
                CoreSession session = new DefaultCoreSession( clonedPrincipal, directoryService );
                opContext.setSession( session );
View Full Code Here

            principalDn = "";
        }

        DN userDn = new DN( principalDn );
        userDn.normalize( service.getSchemaManager().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );

        if ( dn == null )
        {
            dn = "";
        }
View Full Code Here

            principalDn = "";
        }
       
        DN userDn = new DN( principalDn );
        userDn.normalize( service.getSchemaManager().getNormalizerMapping() );
        LdapPrincipal principal = new LdapPrincipal( userDn, AuthenticationLevel.SIMPLE );
       
        if ( dn == null )
        {
            dn = "";
        }
View Full Code Here

        super.init( directoryService );

        DN adminDn = new DN( ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
        adminDn.normalize( directoryService.getSchemaManager().getNormalizerMapping() );
        CoreSession adminSession = new DefaultCoreSession(
            new LdapPrincipal( adminDn, AuthenticationLevel.STRONG ), directoryService );

        tupleCache = new TupleCache( adminSession );
        groupCache = new GroupCache( adminSession );
        schemaManager = directoryService.getSchemaManager();
        //ocRegistry = registries.getObjectClassRegistry();
View Full Code Here

TOP

Related Classes of org.apache.directory.server.core.LdapPrincipal

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.