Package org.apache.directory.api.ldap.extras.extended.whoAmI

Examples of org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponse


        // Create a new RBAC session
        WhoAmIRequest whoAmIRequest = new WhoAmIRequestImpl();

        // Send the request
        WhoAmIResponse whoAmIResponse = ( WhoAmIResponse ) adminConnection.extended( whoAmIRequest );

        assertEquals( ResultCodeEnum.SUCCESS, whoAmIResponse.getLdapResult().getResultCode() );
        assertTrue( whoAmIResponse.isDnAuthzId() );
        assertEquals( "uid=admin,ou=system", whoAmIResponse.getDn().toString() );
        adminConnection.close();
    }
View Full Code Here


    {
        LOG.debug( "WhoAmI requested" );

        LdapPrincipal ldapPrincipal = requestor.getCoreSession().getAuthenticatedPrincipal();
       
        WhoAmIResponse whoAmIResponse = new WhoAmIResponseImpl( req.getMessageId(), ResultCodeEnum.SUCCESS );

        String authzId = "dn:" + ldapPrincipal.getDn();
        whoAmIResponse.setAuthzId( Strings.getBytesUtf8( authzId ) );
       
        // write the response
        requestor.getIoSession().write( whoAmIResponse );
    }
View Full Code Here

        byte[] value = response.getResponseValue();
        ByteBuffer buffer = ByteBuffer.wrap( value );

        WhoAmIResponseContainer container = new WhoAmIResponseContainer();
        WhoAmIResponse whoAmIResponse = null;

        try
        {
            decoder.decode( buffer, container );

            whoAmIResponse = container.getWhoAmIResponse();

            // Now, update the created response with what we got from the extendedResponse
            whoAmIResponse.getLdapResult().setResultCode( response.getLdapResult().getResultCode() );
            whoAmIResponse.getLdapResult().setDiagnosticMessage( response.getLdapResult().getDiagnosticMessage() );
            whoAmIResponse.getLdapResult().setMatchedDn( response.getLdapResult().getMatchedDn() );
            whoAmIResponse.getLdapResult().setReferral( response.getLdapResult().getReferral() );
        }
        catch ( DecoderException de )
        {
            StringWriter sw = new StringWriter();
            de.printStackTrace( new PrintWriter( sw ) );
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.extras.extended.whoAmI.WhoAmIResponse

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.