Skip to content
Discussion options

You must be logged in to vote

With rama you should be able to do whatever you want, and what you are asking especially.

Rama can work with state, question is mostly where do you want to store it?

  • within the process (working memory)?
  • in a database or some other external service?

Either way the answer would be the same though.

Here is a basic architecture on how to add such a middleware (but given it's rama there probably plenty of other ways to do it as well):

#[derive(Debug, Clone)]
struct PowRouter<S, P> {
    inner: S,
    pow: P,
    auth: PowAuthorizer,
}

#[derive(Debug, Clone)]
struct PowAuthorizer;

impl PowAuthorizer {
    pub fn user_authorized(cookie: &str) -> Result<bool, OpaqueError> {
        todo!()
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GlenDC
Comment options

Answer selected by GlenDC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants