Start a custom passwordless flow

@return a request to configure and start
486980
@SuppressWarnings("WeakerAccess")
    private ParameterizableRequest<Void, AuthenticationException> passwordless() {
        HttpUrl url = HttpUrl.parse(auth0.getDomainUrl()).newBuilder()
                .addPathSegment(PASSWORDLESS_PATH)
                .addPathSegment(START_PATH)
                .build();

        final Map<String, Object> parameters = ParameterBuilder.newBuilder()
                .setClientId(getClientId())
                .asDictionary();

        return factory.POST(url, client, gson, authErrorBuilder)
                .addParameters(parameters);
    }
703587
function startRelay(cb) {
        var asyncArr = [],
            hashedPassword = '',
            self = this;

        if (this.process) {
            return cb();
        }

        if (!this.service.socks.port) {
            asyncArr.push(function (cb) {
                freeport(function (err, port) {
                    self.service.socks.port = port;
                    return cb(err);
                });
            });
        }
        if (!this.service.control.port) {
            asyncArr.push(function (cb) {
                freeport(function (err, port) {
                    self.service.control.port = port;
                    return cb(err);
                });
            });
        }

        if (!this.dataDirectory) {
            asyncArr.push(function (cb) {
                var dirname = crypto.createHash('sha1')
                    .update(Date.now().toString() + Math.random().toString())
                    .digest('hex');
                if (self.cleanUpOnExit) {
                    temp.track();
                }
                temp.mkdir(dirname, function (err, path) {
                    self.dataDirectory = path;
                    return cb(err);
                });
            });
        }

        // hash a password
        if (this.service.control.password) {
            asyncArr.push(function (cb) {
                var hashedPasswordCmd;

                hashedPasswordCmd = spawn('tor', ['--hash-password', self.service.control.password]);
                hashedPasswordCmd.stdout.on('data', function (data) {
                    hashedPassword += data.toString();
                });
                hashedPasswordCmd.stdout.on('end', function (status) {
                    if (status) {
                        return cb(new Error('Can not hash your password (Exit status: ' + status + ')'));
                    }
                    hashedPassword = hashedPassword.match(/16:[A-F0-9]{58}/)[0];
                    return cb();
                });
            });
        }

        async.parallel(asyncArr, function (err) {
            var timeout,
                listener = function (event) {
                    if (event.message.indexOf('Tor has successfully opened a circuit') !== -1) {
                        self.removeListener('notice', listener);
                        clearTimeout(timeout);
                        /**
                         * @event TorRequest#ready
                         */
                        self.emit('ready');
                        /**
                         * @callback TorRelay~startCallback
                         * @param {null| error} error - Error if there was one
                         */
                        return cb();
                    }
                },
                params = [//'--RunAsDaemon', '0',
                    '--CookieAuthentication', '0',
                    '--ControlPort', self.service.control.port,
                    //'--PidFile', 'tor.pid',
                    '--SocksPort', self.service.socks.port,
                    '--DataDirectory', self.dataDirectory],
                startFn,
                tries = 0,
                restart;
            if (err) {
                return cb(err);
            }

            if (hashedPassword) {
                params.push('--HashedControlPassword', hashedPassword);
            }
            if (self.service.socks.username && self.service.socks.password) {
                params.push('--Socks5ProxyUsername', self.service.socks.username,
                    '--Socks5ProxyPassword', self.service.socks.password);
            }

            self.on('notice', listener);

            startFn = function () {
                restart = false;
                self.process = spawn('tor', params);
                self.process.on('exit', function () {
                    if (restart) {
                        return startFn();
                    }
                    self.process = null;
                    self.control = null;
                });

                self.process.stdout.on('data', function (chunk) {
                    var arr = chunk.toString().split(/\r?\n/),
                        i,
                        tmp,
                        year = (new Date()).getFullYear();

                    for (i = 0; i < arr.length; i += 1) {
                        if (arr[i] !== '') {
                            tmp = {
                                type: arr[i].substring(arr[i].indexOf('[') + 1, arr[i].indexOf(']')),
                                date: new Date(arr[i].substr(0, 7) + year + arr[i].substr(6, 12)),
                                message: arr[i].substr(arr[i].indexOf(']') + 2),
                                data: arr[i]
                            };
                            /**
                             * @event TorRequest#notice
                             * @type {{}}
                             * @property {string} type - Type of message
                             * @property {Array} messages - Array of messages
                             * @property {number} code - Status code
                             * @property {string} type - Type of message
                             */
                            /**
                             * @event TorRequest#warn
                             * @type {{}}
                             * @property {string} type - Type of message
                             * @property {Array} messages - Array of messages
                             * @property {number} code - Status code
                             * @property {string} type - Type of message
                             */
                            self.emit(tmp.type, tmp);
                        }

                    }
                });

                timeout = setTimeout(function () {
                    console.error('Can not establish a circuit');
                    self.process.kill('SIGKILL');
                    tries += 1;
                    if (self.retries >= tries) {
                        console.error('Retry establishing a circuit', tries);
                        //self.removeAllListeners('notice');
                        //self.removeAllListeners('warn');
                        restart = true;
                        return;
                    }
                    cb(new Error('Can not establish a connection to a circuit'));
                }, self.timeout);
            };

            startFn();



            self.control = new TorControl({
                port: self.service.control.port,
                password: self.service.control.password
            });
        });

    }
706137
private PasswordSource passwordSourceWithPrefix(
            final NodeSSHConnectionInfo nodeAuthentication,
            final String prefix
    ) throws IOException
    {
        if (null != nodeAuthentication.getSudoPasswordStoragePath(prefix)) {
            return new BasicSource(nodeAuthentication.getSudoPasswordStorageData(prefix));
        } else {
            return new BasicSource(nodeAuthentication.getSudoPassword(prefix));
        }
    }
567656
public static HttpServerInterceptorChain<ByteBuf, ByteBuf, ByteBuf, ByteBuf> startRaw() {
        return new HttpServerInterceptorChain<>(new TransformingInterceptor<ByteBuf, ByteBuf, ByteBuf, ByteBuf>() {
            @Override
            public RequestHandler<ByteBuf, ByteBuf> intercept(RequestHandler<ByteBuf, ByteBuf> handler) {
                return handler;
            }
        });
    }
1225595
function startAtRoute( routeName, optionalContext = {} ) {
      return flowController.loadFlow( 'mainz' )
         .then( routerMock.awaitRegisterRoutes )
         .then( () => routerMock.triggerRouteHandler( routeName, optionalContext ) )
         .then( awaitDidNavigate );
   }
707618
public static <T> T getPasswordlessAuthenticationAccount(final Event event, final Class<T> clazz) {
        return event.getAttributes().get("passwordlessAccount", clazz);
    }
351790
protected String buildRedirectUrlByRequestedAuthnContext(final String initialUrl, final AuthnRequest authnRequest, final HttpServletRequest request) {
        val authenticationContextClassMappings = samlProfileHandlerConfigurationContext.getCasProperties()
            .getAuthn().getSamlIdp().getAuthenticationContextClassMappings();
        if (authnRequest.getRequestedAuthnContext() == null || authenticationContextClassMappings == null || authenticationContextClassMappings.isEmpty()) {
            return initialUrl;
        }

        val mappings = getAuthenticationContextMappings();

        val p =
            authnRequest.getRequestedAuthnContext().getAuthnContextClassRefs()
                .stream()
                .filter(ref -> {
                    val clazz = ref.getAuthnContextClassRef();
                    return mappings.containsKey(clazz);
                })
                .findFirst();

        if (p.isPresent()) {
            val mappedClazz = mappings.get(p.get().getAuthnContextClassRef());
            return initialUrl + '&' + samlProfileHandlerConfigurationContext.getCasProperties()
                .getAuthn().getMfa().getRequestParameter() + '=' + mappedClazz;
        }

        return initialUrl;
    }
1175816
public static <T> T getPasswordlessAuthenticationAccount(final RequestContext event, final Class<T> clazz) {
        return getPasswordlessAuthenticationAccount(event.getCurrentEvent(), clazz);
    }
115113
private Request buildEmptyRequest(Request request) {
        RequestBody body = RequestBody.create(MediaType.parse("application/json"), "{}");
        if (request.method().equalsIgnoreCase("get")) {
            return request;
        } else {
            return request.newBuilder().method(request.method(), body).build();
        }
    }
115827
public static OkHttpClient.Builder defaultOkHttpClientBuilder() {
        return new OkHttpClient.Builder()
            .connectTimeout(DEFAULT_CONNECT_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            .readTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            .writeTimeout(DEFAULT_READ_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
            // enables certificate pinning
            .sslSocketFactory(SSLConfig.getSSLSocketFactory(), SSLConfig.getTrustManager());
    }
597070
public AuthenticationRequest getLoginRequest(AuthenticationAPIClient apiClient, String emailOrNumber) {
        Log.d(TAG, String.format("Generating Passwordless Login request for identity %s", emailOrNumber));
        if (getMode() == PasswordlessMode.EMAIL_CODE || getMode() == PasswordlessMode.EMAIL_LINK) {
            return apiClient.loginWithEmail(emailOrNumber, getCode());
        } else {
            return apiClient.loginWithPhoneNumber(emailOrNumber, getCode());
        }
    }
953197
public static FlowContext createFlowContext(final String uuid) {
        if (null == uuid) {
            throw new IllegalArgumentException("Flow context cannot be null");
        }
        final FlowContext flowContext = new FlowContextImpl(uuid);
        addFlowContext(flowContext);
        return flowContext;
    }
92515
public void start()
        throws Exception
    {
        if (getHttpContext().getAuthenticator()==null)
        {
            // Find out the Authenticator.
            if (SecurityConstraint.__BASIC_AUTH.equalsIgnoreCase(_authMethod))
                getHttpContext().setAuthenticator(new BasicAuthenticator());
            else if (SecurityConstraint.__CERT_AUTH.equalsIgnoreCase(_authMethod))
                getHttpContext().setAuthenticator(new ClientCertAuthenticator());
            else
                log.warn("Unknown Authentication method:"+_authMethod);
        }
        
        super.start();
    }
598651
public void doStart(HttpServletRequest request, HttpServletResponse response)
            throws IOException, ServletException {
        if (!common.checkPost(request, response)) return;
        User user = common.requireLoggedInUser(request, response);
        if (user == null) return;

        // Start the authorization process with Dropbox.
        DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
            // After we redirect the user to the Dropbox website for authorization,
            // Dropbox will redirect them back here.
            .withRedirectUri(getRedirectUri(request), getSessionStore(request))
            .build();
        String authorizeUrl = getWebAuth(request).authorize(authRequest);

        // Redirect the user to the Dropbox website so they can approve our application.
        // The Dropbox website will send them back to /dropbox-auth-finish when they're done.
        response.sendRedirect(authorizeUrl);
    }
254845
public void start() {
    proxy.setTrustAllServers(true);
    if (outsideProxy != null) {
      proxy.setChainedProxy(getProxyAddress(outsideProxy));
    }

    addRequestFilter("authentication", new AuthenticationFilter());
    addRequestFilter("requestSizeWatchdog", new RequestSizeWatchdog());
    addResponseFilter("responseSizeWatchdog", new ResponseSizeWatchdog());
    addResponseFilter("download", new FileDownloadFilter(config));

    proxy.start(config.proxyPort());
    port = proxy.getPort();
  }
677482
@Service
    public String startWorkflow(StartWorkflowRequest startWorkflowRequest) {
        return startWorkflow(startWorkflowRequest.getName(), startWorkflowRequest.getVersion(), startWorkflowRequest.getCorrelationId(), startWorkflowRequest.getInput(),
                startWorkflowRequest.getExternalInputPayloadStoragePath(), startWorkflowRequest.getTaskToDomain(), startWorkflowRequest.getWorkflowDef());
    }
792283
public void start() 
		{
		        try 
		        {
		            this.regularBootstrap.bind(new InetSocketAddress(regularConfiguration.getHost(), regularConfiguration.getPort()));
		            if(logger.isInfoEnabled()) {
		            logger.info(regularConfiguration.getName() + " started at " + regularConfiguration.getHost() + " : " + regularConfiguration.getPort());
		            }
		            if(this.securedConfiguration!=null)
		            {
		            	this.securedBootstrap.bind(new InetSocketAddress(securedConfiguration.getHost(), securedConfiguration.getPort()));	
		            	if(logger.isInfoEnabled()) {
		            	logger.info(securedConfiguration.getName() + " uses port : " + securedConfiguration.getPort() + " for TLS clients.");
		            	}
		            }
		        } 
		        catch (ChannelException e) 
		        {
		        	logger.error("Smpp Channel Exception:", e);
		        }
		}