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

SASL/OAUTHBEARER support #252

Closed
einarmo opened this issue Jan 2, 2025 · 2 comments · Fixed by #253
Closed

SASL/OAUTHBEARER support #252

einarmo opened this issue Jan 2, 2025 · 2 comments · Fixed by #253

Comments

@einarmo
Copy link
Contributor

einarmo commented Jan 2, 2025

Would you be willing to accept a contribution implementing SASL/OAUTHBEARER support? This should be relatively simple, especially now that the library depends on rsasl.

The only wrinkle is that this would probably need to contain some form of callback, since on reconnect the client would likely need to request a new token. This callback should probably be async, since it will usually involve some form of async operation. This means async_trait or, if you would prefer to avoid that dependency, requiring users to box their futures themselves with a trait returning Pin<Box<dyn Future<Output = ...> + 'static>>.

Thoughts? I would be willing contribute this, but I'd rather nail down the approach you prefer first.

@crepererum
Copy link
Collaborator

Would you be willing to accept a contribution implementing SASL/OAUTHBEARER support? This should be relatively simple, especially now that the library depends on rsasl.

Yes, PRs are welcome 🙂

The only wrinkle is that this would probably need to contain some form of callback, since on reconnect the client would likely need to request a new token. This callback should probably be async, since it will usually involve some form of async operation. This means async_trait or, if you would prefer to avoid that dependency, requiring users to box their futures themselves with a trait returning Pin<Box<dyn Future<Output = ...> + 'static>>.

I think if it's really just one method, Pin<Box<...>> sounds good enough. You can also use BoxFuture since this is a rather well-known type. To turn this into an actual function (and since async closures aren't available on stable yet), you probably need something like:

type AuthCallback = Box<dyn Fn(Input) -> BoxFuture<'static, Output> + Send + Sync + 'static>;

@einarmo
Copy link
Contributor Author

einarmo commented Jan 2, 2025

Yeah, that looks good. I'll probably look into it then, 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

Successfully merging a pull request may close this issue.

2 participants