score:0

class Keycloak {
    token = "token available";
    url = null;
    realm = null;
    clientId = null;
    tokenParsed = {
        preferred_username: "dummy user",
    }

    constructor(keycloakConfig) {
        this.url = keycloakConfig.url;
        this.realm = keycloakConfig.realm;
        this.clientId = keycloakConfig.clientId;
    }

    login = () => {
        this.token = "Logged in";
    }

    logout = () => {
        this.token = null;
    }

    updateToken = () => {
        this.token = "Logged in";
        return new Promise((resolve, reject) => {
            if (!!this.token) {
                resolve();
            } else {
                reject();
            }
        })
    }

    init = (startupConfig) => {
        
    }

    hasRealmRole = (role) => {
        return true;
    }
}

export default Keycloak;



Related Query

More Query from same tag