authscape 1.0.68 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +103 -23
- package/package.json +1 -1
- package/src/pages/signin-oidc.js +27 -0
- package/src/pages/signout-oidc.js +23 -0
- package/src/services/apiService.js +2 -4
- package/src/services/authService.js +2 -4
- package/src/services/authorizationComponent.js +2 -2
- package/src/services/helper.js +2 -4
- package/src/services/signInValidator.js +2 -4
- package/src/services/slug.js +2 -4
- package/src/services/storeWithExpiry.js +2 -4
package/index.js
CHANGED
|
@@ -59,11 +59,100 @@ exports["default"] = DummyComponent;
|
|
|
59
59
|
|
|
60
60
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
61
61
|
|
|
62
|
+
Object.defineProperty(exports, "__esModule", {
|
|
63
|
+
value: true
|
|
64
|
+
});
|
|
65
|
+
exports["default"] = SigninOidc;
|
|
66
|
+
|
|
67
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
68
|
+
|
|
69
|
+
var _router = require("next/router");
|
|
70
|
+
|
|
71
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
72
|
+
|
|
73
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
74
|
+
|
|
75
|
+
// import {authService, signInValidator} from 'authscape';
|
|
76
|
+
function SigninOidc() {
|
|
77
|
+
var router = (0, _router.useRouter)();
|
|
78
|
+
(0, _react.useEffect)(function () {
|
|
79
|
+
if (!router.isReady) return;
|
|
80
|
+
|
|
81
|
+
if (router.query.code != null) {
|
|
82
|
+
signInValidator(router.query.code);
|
|
83
|
+
} else if (router.query.signupPass != null) {
|
|
84
|
+
authService().login();
|
|
85
|
+
}
|
|
86
|
+
}, [router.isReady]);
|
|
87
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, "Redirecting...");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
;
|
|
91
|
+
"use strict";
|
|
92
|
+
|
|
93
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
94
|
+
|
|
62
95
|
Object.defineProperty(exports, "__esModule", {
|
|
63
96
|
value: true
|
|
64
97
|
});
|
|
65
98
|
exports["default"] = void 0;
|
|
66
99
|
|
|
100
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
101
|
+
|
|
102
|
+
var _router = require("next/router");
|
|
103
|
+
|
|
104
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
105
|
+
|
|
106
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
107
|
+
|
|
108
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
109
|
+
|
|
110
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
111
|
+
|
|
112
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
113
|
+
|
|
114
|
+
function SignoutOidc() {
|
|
115
|
+
var router = (0, _router.useRouter)();
|
|
116
|
+
(0, _react.useEffect)(function () {
|
|
117
|
+
function signoutAsync() {
|
|
118
|
+
return _signoutAsync.apply(this, arguments);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function _signoutAsync() {
|
|
122
|
+
_signoutAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
124
|
+
while (1) {
|
|
125
|
+
switch (_context.prev = _context.next) {
|
|
126
|
+
case 0:
|
|
127
|
+
//alert("need to remove items from local storage");
|
|
128
|
+
router.push('/');
|
|
129
|
+
|
|
130
|
+
case 1:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context.stop();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, _callee);
|
|
136
|
+
}));
|
|
137
|
+
return _signoutAsync.apply(this, arguments);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
signoutAsync();
|
|
141
|
+
});
|
|
142
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, "Redirecting...");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var _default = SignoutOidc;
|
|
146
|
+
exports["default"] = _default;
|
|
147
|
+
"use strict";
|
|
148
|
+
|
|
149
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
150
|
+
|
|
151
|
+
Object.defineProperty(exports, "__esModule", {
|
|
152
|
+
value: true
|
|
153
|
+
});
|
|
154
|
+
exports.apiService = void 0;
|
|
155
|
+
|
|
67
156
|
var _axios = _interopRequireDefault(require("axios"));
|
|
68
157
|
|
|
69
158
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
@@ -576,8 +665,7 @@ var apiService = function apiService() {
|
|
|
576
665
|
};
|
|
577
666
|
};
|
|
578
667
|
|
|
579
|
-
|
|
580
|
-
exports["default"] = _default;
|
|
668
|
+
exports.apiService = apiService;
|
|
581
669
|
"use strict";
|
|
582
670
|
|
|
583
671
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
@@ -585,14 +673,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
585
673
|
Object.defineProperty(exports, "__esModule", {
|
|
586
674
|
value: true
|
|
587
675
|
});
|
|
588
|
-
exports
|
|
676
|
+
exports.AuthorizationComponent = AuthorizationComponent;
|
|
589
677
|
|
|
590
678
|
var _react = _interopRequireWildcard(require("react"));
|
|
591
679
|
|
|
592
|
-
var _apiService = _interopRequireDefault(require("./apiService"));
|
|
593
|
-
|
|
594
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
595
|
-
|
|
596
680
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
597
681
|
|
|
598
682
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -615,6 +699,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
615
699
|
|
|
616
700
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
617
701
|
|
|
702
|
+
//import apiService from './apiService';
|
|
618
703
|
function AuthorizationComponent(_ref) {
|
|
619
704
|
var children = _ref.children,
|
|
620
705
|
setCurrentUser = _ref.setCurrentUser,
|
|
@@ -635,7 +720,7 @@ function AuthorizationComponent(_ref) {
|
|
|
635
720
|
case 0:
|
|
636
721
|
setLoaded(true);
|
|
637
722
|
_context.next = 3;
|
|
638
|
-
return (
|
|
723
|
+
return apiService().GetCurrentUser();
|
|
639
724
|
|
|
640
725
|
case 3:
|
|
641
726
|
usr = _context.sent;
|
|
@@ -675,7 +760,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
675
760
|
Object.defineProperty(exports, "__esModule", {
|
|
676
761
|
value: true
|
|
677
762
|
});
|
|
678
|
-
exports
|
|
763
|
+
exports.authService = void 0;
|
|
679
764
|
|
|
680
765
|
var _react = _interopRequireDefault(require("react"));
|
|
681
766
|
|
|
@@ -858,14 +943,13 @@ var authService = function authService() {
|
|
|
858
943
|
};
|
|
859
944
|
};
|
|
860
945
|
|
|
861
|
-
|
|
862
|
-
exports["default"] = _default;
|
|
946
|
+
exports.authService = authService;
|
|
863
947
|
"use strict";
|
|
864
948
|
|
|
865
949
|
Object.defineProperty(exports, "__esModule", {
|
|
866
950
|
value: true
|
|
867
951
|
});
|
|
868
|
-
exports
|
|
952
|
+
exports.Helper = void 0;
|
|
869
953
|
|
|
870
954
|
var _react = _interopRequireDefault(require("react"));
|
|
871
955
|
|
|
@@ -879,8 +963,7 @@ var Helper = function Helper() {
|
|
|
879
963
|
};
|
|
880
964
|
};
|
|
881
965
|
|
|
882
|
-
|
|
883
|
-
exports["default"] = _default;
|
|
966
|
+
exports.Helper = Helper;
|
|
884
967
|
"use strict";
|
|
885
968
|
|
|
886
969
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
@@ -888,7 +971,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
888
971
|
Object.defineProperty(exports, "__esModule", {
|
|
889
972
|
value: true
|
|
890
973
|
});
|
|
891
|
-
exports
|
|
974
|
+
exports.signInValidator = void 0;
|
|
892
975
|
|
|
893
976
|
var _react = _interopRequireWildcard(require("react"));
|
|
894
977
|
|
|
@@ -993,14 +1076,13 @@ var signInValidator = /*#__PURE__*/function () {
|
|
|
993
1076
|
};
|
|
994
1077
|
}();
|
|
995
1078
|
|
|
996
|
-
|
|
997
|
-
exports["default"] = _default;
|
|
1079
|
+
exports.signInValidator = signInValidator;
|
|
998
1080
|
"use strict";
|
|
999
1081
|
|
|
1000
1082
|
Object.defineProperty(exports, "__esModule", {
|
|
1001
1083
|
value: true
|
|
1002
1084
|
});
|
|
1003
|
-
exports
|
|
1085
|
+
exports.Slug = void 0;
|
|
1004
1086
|
|
|
1005
1087
|
var Slug = function Slug(slug) {
|
|
1006
1088
|
var index = slug.lastIndexOf("-") + 1;
|
|
@@ -1013,14 +1095,13 @@ var Slug = function Slug(slug) {
|
|
|
1013
1095
|
return null;
|
|
1014
1096
|
};
|
|
1015
1097
|
|
|
1016
|
-
|
|
1017
|
-
exports["default"] = _default;
|
|
1098
|
+
exports.Slug = Slug;
|
|
1018
1099
|
"use strict";
|
|
1019
1100
|
|
|
1020
1101
|
Object.defineProperty(exports, "__esModule", {
|
|
1021
1102
|
value: true
|
|
1022
1103
|
});
|
|
1023
|
-
exports
|
|
1104
|
+
exports.storeWithExpiry = void 0;
|
|
1024
1105
|
|
|
1025
1106
|
var storeWithExpiry = function storeWithExpiry() {
|
|
1026
1107
|
return {
|
|
@@ -1052,5 +1133,4 @@ var storeWithExpiry = function storeWithExpiry() {
|
|
|
1052
1133
|
};
|
|
1053
1134
|
};
|
|
1054
1135
|
|
|
1055
|
-
|
|
1056
|
-
exports["default"] = _default;
|
|
1136
|
+
exports.storeWithExpiry = storeWithExpiry;
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { useRouter } from 'next/router';
|
|
3
|
+
// import {authService, signInValidator} from 'authscape';
|
|
4
|
+
|
|
5
|
+
export default function SigninOidc() {
|
|
6
|
+
|
|
7
|
+
const router = useRouter();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if(!router.isReady) return;
|
|
10
|
+
|
|
11
|
+
if (router.query.code != null)
|
|
12
|
+
{
|
|
13
|
+
signInValidator(router.query.code);
|
|
14
|
+
}
|
|
15
|
+
else if (router.query.signupPass != null)
|
|
16
|
+
{
|
|
17
|
+
authService().login();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
}, [router.isReady]);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<div>
|
|
24
|
+
Redirecting...
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { useRouter } from 'next/router'
|
|
3
|
+
|
|
4
|
+
function SignoutOidc() {
|
|
5
|
+
const router = useRouter();
|
|
6
|
+
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
async function signoutAsync() {
|
|
9
|
+
|
|
10
|
+
//alert("need to remove items from local storage");
|
|
11
|
+
router.push('/');
|
|
12
|
+
}
|
|
13
|
+
signoutAsync()
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<div>
|
|
18
|
+
Redirecting...
|
|
19
|
+
</div>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default SignoutOidc
|
|
@@ -87,7 +87,7 @@ const RefreshToken = async (originalRequest, instance) => {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const apiService = (ctx = {}) => {
|
|
90
|
+
export const apiService = (ctx = {}) => {
|
|
91
91
|
|
|
92
92
|
let env = process.env.STAGE;
|
|
93
93
|
if (env == "development")
|
|
@@ -248,6 +248,4 @@ const apiService = (ctx = {}) => {
|
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export default apiService;
|
|
251
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { destroyCookie } from 'nookies';
|
|
3
3
|
|
|
4
|
-
const authService = () => {
|
|
4
|
+
export const authService = () => {
|
|
5
5
|
|
|
6
6
|
return {
|
|
7
7
|
|
|
@@ -105,6 +105,4 @@ const authService = () => {
|
|
|
105
105
|
|
|
106
106
|
},
|
|
107
107
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default authService;
|
|
108
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
-
import apiService from './apiService';
|
|
2
|
+
//import apiService from './apiService';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function AuthorizationComponent({children, setCurrentUser, userLoaded, isLoading}) {
|
|
5
5
|
|
|
6
6
|
const [loaded, setLoaded] = useState(false);
|
|
7
7
|
const validateUserSignedIn = async () => {
|
package/src/services/helper.js
CHANGED
|
@@ -3,7 +3,7 @@ import axios from 'axios';
|
|
|
3
3
|
import querystring from "querystring";
|
|
4
4
|
import { setCookie } from 'nookies';
|
|
5
5
|
|
|
6
|
-
const signInValidator = async (queryCode) => {
|
|
6
|
+
export const signInValidator = async (queryCode) => {
|
|
7
7
|
|
|
8
8
|
let codeVerifier = window.localStorage.getItem("verifier");
|
|
9
9
|
if (queryCode != null && codeVerifier != null)
|
|
@@ -63,6 +63,4 @@ const signInValidator = async (queryCode) => {
|
|
|
63
63
|
window.location.href = "/";
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export default signInValidator;
|
|
66
|
+
}
|
package/src/services/slug.js
CHANGED