/** * Resolves the authzId (user) of a simple bind request. * * @param bindRequest The bind request, must not be {@code null}. * * @return The authzId, {@code null} if it couldn't be resolved. */ public static AuthzId resolve(final SimpleBindRequest bindRequest) { if (bindRequest == null) throw new IllegalArgumentException("The bind request must not be null"); DN user; try { user = new DN(bindRequest.getBindDN()); } catch (LDAPException e ) { return null; } return new AuthzId(user); }
/** * Creates a new bind request protocol op from the provided bind request * object. * * @param request The simple bind request to use to create this protocol op. * It must have been created with a static password rather * than using a password provider. * * @throws LDAPSDKUsageException If the provided simple bind request is * configured to use a password provider * rather than a static password. */ public BindRequestProtocolOp(final SimpleBindRequest request) throws LDAPSDKUsageException { version = 3; credentialsType = CRED_TYPE_SIMPLE; bindDN = request.getBindDN(); simplePassword = request.getPassword(); saslMechanism = null; saslCredentials = null; if (simplePassword == null) { throw new LDAPSDKUsageException( ERR_BIND_REQUEST_CANNOT_CREATE_WITH_PASSWORD_PROVIDER.get()); } }
/** * Creates a new bind request protocol op from the provided bind request * object. * * @param request The simple bind request to use to create this protocol op. * It must have been created with a static password rather * than using a password provider. * * @throws LDAPSDKUsageException If the provided simple bind request is * configured to use a password provider * rather than a static password. */ public BindRequestProtocolOp(final SimpleBindRequest request) throws LDAPSDKUsageException { version = 3; credentialsType = CRED_TYPE_SIMPLE; bindDN = request.getBindDN(); simplePassword = request.getPassword(); saslMechanism = null; saslCredentials = null; if (simplePassword == null) { throw new LDAPSDKUsageException( ERR_BIND_REQUEST_CANNOT_CREATE_WITH_PASSWORD_PROVIDER.get()); } }
bindOp = new BindRequestProtocolOp(r.getBindDN(), r.getPassword().getValue());