/** * Creates a new instance of BindOperationContext. * * @param session The session to use */ public BindOperationContext( CoreSession session ) { super( session ); if ( session != null ) { setInterceptors( session.getDirectoryService().getInterceptors( OperationEnum.BIND ) ); } }
/** * Get back a session for the give user and credentials bound with Simple Bind */ public CoreSession getSession( Dn principalDn, byte[] credentials ) throws LdapException { synchronized ( this ) { if ( !started ) { throw new IllegalStateException( "Service has not started." ); } } BindOperationContext bindContext = new BindOperationContext( null ); bindContext.setCredentials( credentials ); bindContext.setDn( principalDn.apply( schemaManager ) ); bindContext.setInterceptors( getInterceptors( OperationEnum.BIND ) ); operationManager.bind( bindContext ); return bindContext.getSession(); }
/** * Get back a session for a given user bound with SASL Bind */ public CoreSession getSession( Dn principalDn, byte[] credentials, String saslMechanism, String saslAuthId ) throws Exception { synchronized ( this ) { if ( !started ) { throw new IllegalStateException( "Service has not started." ); } } BindOperationContext bindContext = new BindOperationContext( null ); bindContext.setCredentials( credentials ); bindContext.setDn( principalDn.apply( schemaManager ) ); bindContext.setSaslMechanism( saslMechanism ); bindContext.setInterceptors( getInterceptors( OperationEnum.BIND ) ); operationManager.bind( bindContext ); return bindContext.getSession(); }
bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) );
/** * Used to encapsulate [de]marshalling of controls before and after bind operations. * * @param bindDn The user's Dn * @param credentials The credentials * @param saslMechanism The SASL mechanism to use * @param saslAuthId The SASL authorization ID * @return A BindOperationContext instance * @throws Exception If the Bind failed */ protected BindOperationContext doBindOperation( Dn bindDn, byte[] credentials, String saslMechanism, String saslAuthId ) throws Exception { // setup the op context and populate with request controls BindOperationContext bindContext = new BindOperationContext( null ); bindContext.setDn( bindDn ); bindContext.setCredentials( credentials ); bindContext.setSaslMechanism( saslMechanism ); bindContext.setSaslAuthId( saslAuthId ); bindContext.addRequestControls( convertControls( true, requestControls ) ); bindContext.setInterceptors( getDirectoryService().getInterceptors( OperationEnum.BIND ) ); // execute bind operation OperationManager operationManager = service.getOperationManager(); operationManager.bind( bindContext ); // clear the request controls and set the response controls requestControls = EMPTY_CONTROLS; responseControls = JndiUtils.toJndiControls( getDirectoryService().getLdapCodecService(), bindContext.getResponseControls() ); return bindContext; }
bindContext.setInterceptors( ldapSession.getLdapServer().getDirectoryService() .getInterceptors( OperationEnum.BIND ) );
bindContext.setCredentials( bindRequest.getCredentials() ); bindContext.setIoSession( ldapSession.getIoSession() ); bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) ); bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) ); directoryService.getOperationManager().bind( bindContext );
bindContext.setCredentials( Strings.getBytesUtf8( password ) ); bindContext.setIoSession( ldapSession.getIoSession() ); bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) );