Simple authentication services for login/logout
company.services.auth or easy access with BaseAuth
Requirements: Jquery
- To authenticate on login
window.company.services.BaseAuth.login()
- To authenticate on logout
window.company.services.BaseAuth.logout()
- To authenticate only
window.company.services.BaseAuth.isAuthenticated()
- To getToken
var token = window.company.services.BaseAuth.getToken()
var oneAuth = new window.company.services.BaseAuth({
serverUrl: "http://localhost:8081"
});
console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());
- mock login
console.log(oneAuth.login({username: "longh",password: "password"}));
console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());
console.log(oneAuth.getServerUrl());
- mock logout
console.log(oneAuth.logout());
console.log(oneAuth.isAuthenticated());
console.log(oneAuth.getToken());