-
Notifications
You must be signed in to change notification settings - Fork 88
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
Actix frontend #15
Comments
This will not land in master for now because of the multiple native library dependencies. Rouille and Actix collide with different versions of The other problem is ring, used by |
It sometimes seems as if a request was blocking and leading to a timeout on all future requests. I have no idea why that is? |
Want this badly. Need help? How far is this done, and what are common problems? |
After reworking the frontend to provide an actor based endpoint, everything now works as expected. This means that the basic architecture for this frontend is likely staying as is although the interfaces are not stable yet. |
Hi! I'm building a backend in Actix that'll use OAuth2 and Oxide-auth looks like it'd fit the bill perfectly. I wondered if I could ask, if it's not too pushy to do so, what the status of this frontend is. Is there more left to do, and/or can I get Cargo to use the dev branch so I can take it for a spin? Thanks! |
You have two choices:
The first option will give you a (hopefully) stable experience while the latter will give you new interfaces sooner. Stable version v0.4.0 should be selected, once published, with both version by using Status on the development is that I'm busy with University end terms until the end of the month and I will continue to work towards the release of 0.4 in August. And if you find anything unpleasant or interface improvements, feel free to open additional issues for those. I will get to them then. |
Excellent, thank you! I'll go with the former I think. |
I tried both of these solutions, and unfortunately couldn't get it working. I managed to get it working by bumping |
Thanks for letting me know, I'll update the dependencies for the next version. |
@zoidbergwill There were some other issues in the examples, see 20b921f if you need to rebase it quickly. Most importantly, in the bottom is an update to the trait that provides |
Awesome, thanks, I'll have a look today. Didn't manage to try it yesterday. |
I am using this to implement an oauth server using Actix. I am facing a problem. I have an pub struct DbExecutor(pub Pool<ConnectionManager<MysqlConnection>>);
impl Actor for DbExecutor {
type Context = SyncContext<Self>;
}
pub struct AppState {
db: Addr<DbExecutor>,
endpoint: Addr<CodeGrantEndpoint<_>>,
} I referred this example. Problem is the compiler is not letting me to use I understood that I have to use Sorry if the question is too simple. I am new to Rust, Actix environment. I am trying to understand these stuff. |
The correct type for this would really be the types of the lambda-functions used in the builder of |
The text below is only for the case where you need lambdas. If you can use standard methods instead, you can use those as type-parameters in the I don't think type-erasure is possible on the
then you can instead use:
|
It's good to note this inconvenience. That means I will try to avoid using deduced types in the future for the actix interface. An alternative would be to include the above in the crate itself but it is not as general as I'd like. |
@HeroicKatora what's the status of this? Do you know something that prevents this to be merged? |
The current implementation ( One huge change that should definitely blocks So, maybe as a Christmas present. Migration guide etc. included. |
I decided to use standard method as types. The code looks like: pub struct AppState<A, B, C>
where
A: Fn(ClientMap, Storage<RandomGenerator>, TokenSigner, &'static[Scope]) -> AuthorizationFlow,
B: Fn(ClientMap, Storage<RandomGenerator>, TokenSigner, &'static[Scope]) -> GrantFlow,
C: Fn(ClientMap, Storage<RandomGenerator>, TokenSigner, &'static[Scope]) -> AccessFlow,
{
pub db: Addr<DbExecutor>,
pub endpoint: Addr<CodeGrantEndpoint<A, B, C>>,
} I have a method that creates a new pub fn create_app() -> App<AppState<A, B, C>> {
// skipped for simplicity
} The compiler says that it can't find Could you help me here please @HeroicKatora Thanks! |
In
the code needs to refer to specific methods (methods are the only implementors of
|
I am getting errors:
Here's what I did: pub fn create_authorization(client: &ClientMap, authorizer: &Storage<RandomGenerator>, issuer: &TokenSigner, scopes: &'static[Scope]) -> AuthorizationFlow {
AuthorizationFlow::new(client, authorizer)
}
pub fn create_grant(client: &ClientMap, authorizer: &Storage<RandomGenerator>, issuer: &TokenSigner, scopes: &'static[Scope]) -> GrantFlow {
GrantFlow::new(client, authorizer, issuer)
}
pub fn create_access(client: &ClientMap, authorizer: &Storage<RandomGenerator>, issuer: &TokenSigner, scopes: &'static[Scope]) -> AccessFlow {
AccessFlow::new(issuer, scopes)
}
pub fn create_app() -> App<AppState<create_authorization, create_grant, create_access>> {
} |
@subhojit777 Sorry. My bad, the type of a raw function is
It's good that these issues come up now, because they shouldn't be in the actual release for Edit: Example usage that compiles and works here: https://github.com/HeroicKatora/oxide-auth/blob/ed716549500df285ad23c68d4987013c92dd0736/examples/authorization_actix.rs |
Thanks a lot for the quick help! Did you mean
I wanted to lookup the code for |
Yes, |
I'm very happy to report that Note that this code portion is not optimized for performance, contains some copy and unecessary boxing but all of that makes the interface much cleaner for now. |
Alright, just going to complete the example and add some more utilities. Then going for a |
|
Feature
Actix is arguably a quickly evolving library and its web framework has been proven to be very performant.
The greatest challenge is translation between
Future
structures and the sequential handling of requests here.Tracking pull request
The text was updated successfully, but these errors were encountered: