unilim-cas 1.0.1

A purrfect CAS authentication wrapper for Unilim.
Documentation
#[cfg(all(target_arch = "wasm32", feature = "npm"))]
use wasm_bindgen::prelude::wasm_bindgen;

/// a cas-fronted service reachable through sso.
#[cfg_attr(all(target_arch = "wasm32", feature = "npm"), wasm_bindgen)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Services {
    /// moodle instance at `communities.unilim.fr`.
    Communities,
    /// moodle instance of the iut at `community-iut.unilim.fr`.
    CommunityIut,
    /// grade reports at `inscription.unilim.fr`.
    Grading,
}

impl Services {
    /// the url used as the `service` parameter of `/cas/login`.
    pub fn url(self) -> &'static str {
        match self {
            Services::Communities => "https://communities.unilim.fr/login/index.php?authCAS=CAS",
            Services::CommunityIut => "https://community-iut.unilim.fr/login/index.php?authCAS=CAS",
            Services::Grading => "https://inscription.unilim.fr/gestion/etudiant/rvn/",
        }
    }
}