unilim-cas 1.0.1

A purrfect CAS authentication wrapper for Unilim.
Documentation
//! extern declarations of the `@unilim/cas` js classes.
//!
//! lets another rust-to-wasm package receive the session object of the npm
//! package across the js boundary.

use wasm_bindgen::prelude::*;

#[wasm_bindgen(module = "@unilim/cas")]
extern "C" {
    pub type OAuth2;

    #[wasm_bindgen(constructor)]
    pub fn new(identifier: String, callback: String, scopes: Vec<String>) -> OAuth2;

    pub type CAS;

    #[wasm_bindgen(method, getter)]
    pub fn cookie(this: &CAS) -> String;

    /// resolves to the authorization callback url as a string.
    #[wasm_bindgen(method, catch)]
    pub async fn authorize(
        this: &CAS,
        client: &OAuth2,
        challenge: Option<bool>,
        state: Option<String>,
    ) -> Result<JsValue, JsValue>;

    /// resolves to a `Tokens` object.
    #[wasm_bindgen(method, catch)]
    pub async fn tokenize(
        this: &CAS,
        callback: String,
        client: &OAuth2,
        challenge: Option<bool>,
    ) -> Result<JsValue, JsValue>;
}