Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different redirect url than http://localhost:7890/redshift/ #208

Open
kromanow94 opened this issue Feb 6, 2024 · 2 comments
Open

Different redirect url than http://localhost:7890/redshift/ #208

kromanow94 opened this issue Feb 6, 2024 · 2 comments

Comments

@kromanow94
Copy link

Driver version

redshift-connector 2.0.917

Redshift version

Not related.

Client Operating System

Ubuntu 22.04.2 LTS running code-server on Kubeflow Notebook in AWS EKS.

Python version

Python 3.10.6

Table schema

Not related.

Problem description

  1. Expected behaviour:
    Login with following script should work:

    import redshift_connector
    
    conn: redshift_connector.Connection = redshift_connector.connect(
        iam=True,
        database=redacted,
        host=redacted,
        cluster_identifier=redacted,
        credentials_provider='BrowserSamlCredentialsProvider',
        login_url=corporate_sso_login_url,
        region=region,
        preferred_role=redacted
    )
    

    This results with a successful login with the IdP but the redirect to the http://localhost:7890/redshift/ is not suitable for me because the redshift_connector is running on a remote server with code-server.

  2. Actual behaviour:
    It should be possible to define different redirect url.

  3. Error message/stack trace:
    image

  4. Any other details that can be helpful:
    I'm thinking of some solution using proxy but then the redirect url would have to point to the proxy server.

    Also, code-server has the functionality to create a proxy for open ports. For example, running the script above creates an endpoint like https://kubeflow.example.com/notebook/nb_ns/nb_name/proxy/7890/.

    Any other ideas on how this scenario can be handled are very much welcomed.

Python Driver trace logs

Not related.

@Brooke-white
Copy link
Contributor

Hey @kromanow94,

Thanks for reaching out regarding this. For reference, here is where we implement BrowserSamlCredentialsProvider. The problematic piece of code is the run_server() method, which hardcodes HOST to localhost. One work around to implement a class which extends BrowserSamlCredentialsProvider and modify the run_server() method to use a different value for HOST, and if needed PORT. Unfortunately this is a bit messy given how run_server() is implemented. for example

class myPlugin(BrowserSamlCredentialsProvider):
  def run_server(self, listen_port, idp_response_timeout) -> str:
    HOST = "your_host"
   PORT = "your_port"
   # rest of method


redshift_connector.connect(
    ...,
    credentials_provider="your.path.to.myPlugin",
   ..., 

@kromanow94
Copy link
Author

Hey @Brooke-white ,

Thanks for explaining. I'll give it a try. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants