fn auth_response(
        redir_url: RedirectUrl,
        http_req: &HttpRequest,
    ) -> Result<HttpResponse, TelescopeError> {
        // Get the client configuration and build out the authentication request parameters.
        let client: Arc<BasicClient> = Self::get_client();
        let mut auth_req: AuthorizationRequest = client
            // Randomly generate a CSRF token.
            .authorize_url(CsrfToken::new_random)
            // Add the redirect URL.
            .set_redirect_uri(Cow::Owned(redir_url));

        // Add the scopes defined by this Identity provider and convert the
        // request into the target URL and assocated CSRF token.
        for scope in Self::scopes() {
            auth_req = auth_req.add_scope(scope);
        }
        let (url, csrf_token) = auth_req.url();

        // Save CSRF token.
        csrf::save(Self::SERVICE_NAME, http_req, csrf_token)?;

        // Return the URL in an HTTP redirect response.
        return Ok(HttpResponse::Found()
            .header(LOCATION, url.as_str())
            .finish());
    }
/// Get the redirect URL for the associated client and build an HTTP response to take the user
/// there. Saves the CSRF token in the process.
Get the redirect URL for the associated client and build an HTTP response to take the user
there. Saves the CSRF token in the process.
Get the redirect URL for the associated client and build an HTTP response to take the user there . Saves the CSRF token in the process .
fn auth_response(
        redir_url: RedirectUrl,
        http_req: &HttpRequest,
    ) -> Result<HttpResponse, TelescopeError> {
        // Get the client configuration and build out the authentication request parameters.
        let client: Arc<BasicClient> = Self::get_client();
        let mut auth_req: AuthorizationRequest = client
            // Randomly generate a CSRF token.
            .authorize_url(CsrfToken::new_random)
            // Add the redirect URL.
            .set_redirect_uri(Cow::Owned(redir_url));
        // Add the scopes defined by this Identity provider and convert the
        // request into the target URL and assocated CSRF token.
        for scope in Self::scopes() {
            auth_req = auth_req.add_scope(scope);
        }
        let (url, csrf_token) = auth_req.url();
        // Save CSRF token.
        csrf::save(Self::SERVICE_NAME, http_req, csrf_token)?;
        // Return the URL in an HTTP redirect response.
        return Ok(HttpResponse::Found()
            .header(LOCATION, url.as_str())
            .finish());
    }
fn auth_response ( redir_url : RedirectUrl , http_req : & HttpRequest , ) -> Result < HttpResponse , TelescopeError > { // Get the client configuration and build out the authentication request parameters. let client : Arc < BasicClient > = Self :: get_client ( ) ; let mut auth_req : AuthorizationRequest = client // Randomly generate a CSRF token. . authorize_url ( CsrfToken :: new_random ) // Add the redirect URL. . set_redirect_uri ( Cow :: Owned ( redir_url ) ) ; // Add the scopes defined by this Identity provider and convert the // request into the target URL and assocated CSRF token. for scope in Self :: scopes ( ) { auth_req = auth_req . add_scope ( scope ) ; } let ( url , csrf_token ) = auth_req . url ( ) ; // Save CSRF token. csrf :: save ( Self :: SERVICE_NAME , http_req , csrf_token ) ? ; // Return the URL in an HTTP redirect response. return Ok ( HttpResponse :: Found ( ) . header ( LOCATION , url . as_str ( ) ) . finish ( ) ) ; }
Get the redirect URL for the associated client and build an HTTP response to take the user
there.
Get the redirect URL for the associated client and build an HTTP response to take the user there .
redir_url
RedirectUrl
http_req
&HttpRequest
redir_url
RedirectUrl
http_req
&HttpRequest