@chustasoft/cs-authorization-connector
Version:
JS connector library for ChustaSoft Authorization library based on Microsoft AspNet Identity
41 lines (40 loc) • 1.93 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthorizationService = void 0;
const cs_common_1 = require("@chustasoft/cs-common");
class AuthorizationService {
constructor(authorizationApiUrl) {
this.authorizationApiUrl = authorizationApiUrl;
this.httpService = new cs_common_1.HttpService();
}
register(credentials) {
return __awaiter(this, void 0, void 0, function* () {
return this.httpService.post(`${this.authorizationApiUrl}/auth/register`, credentials);
});
}
login(credentials) {
return __awaiter(this, void 0, void 0, function* () {
return this.httpService.post(`${this.authorizationApiUrl}/auth/login`, credentials);
});
}
confirm(userValidation) {
return __awaiter(this, void 0, void 0, function* () {
return this.httpService.post(`${this.authorizationApiUrl}/auth/confirm`, userValidation);
});
}
activate(userActivation) {
return __awaiter(this, void 0, void 0, function* () {
return this.httpService.post(`${this.authorizationApiUrl}/auth/activate`, userActivation);
});
}
}
exports.AuthorizationService = AuthorizationService;