HeroicKatora/oxide-auth

Interface of Solicitor is not evolvable

HeroicKatora opened this issue · 0 comments

Project Improvement

The interface of solicitor is hard to amend in SemVer compatible updates. It is handed very public structs for which we can not add much internal information. It would be better to encapsulate this slightly into a Solicitation or something. This causes #42 by making is awkward to generate the correct solicitation page with a redirect.

Draft

Add a new structure referencing the internal state of a request which is currently handed by reference. Note that the state itself lives within the statemachine, so we should add according accessors there as well. We hand an opaque struct with references, not references themselves as we don't want the user/solicitor to overwrite the objects of state itself.

/// With public accessors each.
pub struct Solicitation<'internal> {
    request: &'internal PreGrant,
    state: &'internal str,
    // Maybe?
    extensions: &'internal mut Extensions,
}

pub trait OwnerSolicitor<Request: WebRequest> {
    fn check_consent(&mut self, _: &mut Request, context: Solicitation) -> OwnerConsent<Request::Response>;
}

Tracking pull request

  • A pull request does not yet exist