@multiplatform.one/keycloak 0.3.32 → 0.3.33
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/dist/esm/hooks/useKeycloak/index.mjs.map +1 -1
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs +481 -45
- package/dist/esm/hooks/useKeycloak/useKeycloak.mjs.map +3 -3
- package/dist/esm/hooks/useKeycloak/useKeycloak.native.mjs.map +1 -1
- package/dist/jsx/hooks/useKeycloak/index.mjs.map +1 -1
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs +59 -15
- package/dist/jsx/hooks/useKeycloak/useKeycloak.mjs.map +2 -2
- package/dist/jsx/hooks/useKeycloak/useKeycloak.native.mjs.map +1 -1
- package/dist/lib/hooks/useKeycloak/index.d.ts +3 -4
- package/dist/lib/hooks/useKeycloak/index.js.map +1 -1
- package/dist/lib/hooks/useKeycloak/useKeycloak.d.ts +19 -2
- package/dist/lib/hooks/useKeycloak/useKeycloak.js +70 -31
- package/dist/lib/hooks/useKeycloak/useKeycloak.js.map +2 -2
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.d.ts +4 -4
- package/dist/lib/hooks/useKeycloak/useKeycloak.native.js.map +1 -1
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/hooks/useKeycloak/index.ts +3 -4
- package/src/hooks/useKeycloak/useKeycloak.native.ts +3 -3
- package/src/hooks/useKeycloak/useKeycloak.ts +71 -16
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.ts"],
|
|
4
|
-
"sourcesContent": ["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); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 31-05-2023 12:49:27\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from \"../useAuthConfig.mjs\";\nimport { useKeycloak as useReactKeycloak } from '@bitspur/react-keycloak-web';\nimport { useKeycloak as useSsrKeycloak } from '@bitspur/react-keycloak-ssr';\nexport function useKeycloak() {\n var _keycloak$tokenParsed4, _keycloak$tokenParsed5, _keycloak$tokenParsed6;\n var authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) {\n return {\n authenticated: true,\n username: 'storybook',\n email: 'storybook@example.com',\n userId: '0'\n };\n }\n if (MultiPlatform.isNext && authConfig.ssr) {\n var _keycloak$tokenParsed, _keycloak$tokenParsed2, _keycloak$tokenParsed3;\n var _useSsrKeycloak = useSsrKeycloak(),\n _keycloak = _useSsrKeycloak.keycloak,\n _initialized = _useSsrKeycloak.initialized;\n return _objectSpread(_objectSpread({}, _keycloak), {}, {\n authenticated: _initialized ? _keycloak === null || _keycloak === void 0 ? void 0 : _keycloak.authenticated : undefined,\n email: _keycloak === null || _keycloak === void 0 ? void 0 : (_keycloak$tokenParsed = _keycloak.tokenParsed) === null || _keycloak$tokenParsed === void 0 ? void 0 : _keycloak$tokenParsed.email,\n userId: _keycloak === null || _keycloak === void 0 ? void 0 : (_keycloak$tokenParsed2 = _keycloak.tokenParsed) === null || _keycloak$tokenParsed2 === void 0 ? void 0 : _keycloak$tokenParsed2.sub,\n username: _keycloak === null || _keycloak === void 0 ? void 0 : (_keycloak$tokenParsed3 = _keycloak.tokenParsed) === null || _keycloak$tokenParsed3 === void 0 ? void 0 : _keycloak$tokenParsed3.preferred_username\n });\n }\n var _useReactKeycloak = useReactKeycloak(),\n keycloak = _useReactKeycloak.keycloak,\n initialized = _useReactKeycloak.initialized;\n return _objectSpread(_objectSpread({}, keycloak), {}, {\n authenticated: initialized ? keycloak === null || keycloak === void 0 ? void 0 : keycloak.authenticated : undefined,\n email: keycloak === null || keycloak === void 0 ? void 0 : (_keycloak$tokenParsed4 = keycloak.tokenParsed) === null || _keycloak$tokenParsed4 === void 0 ? void 0 : _keycloak$tokenParsed4.email,\n userId: keycloak === null || keycloak === void 0 ? void 0 : (_keycloak$tokenParsed5 = keycloak.tokenParsed) === null || _keycloak$tokenParsed5 === void 0 ? void 0 : _keycloak$tokenParsed5.sub,\n username: keycloak === null || keycloak === void 0 ? void 0 : (_keycloak$tokenParsed6 = keycloak.tokenParsed) === null || _keycloak$tokenParsed6 === void 0 ? void 0 : _keycloak$tokenParsed6.preferred_username\n });\n}"],
|
|
5
|
-
"mappings": "AAAA,SAAS,QAAQ,KAAK;AAAE;AAA2B,SAAO,UAAU,cAAc,OAAO,UAAU,YAAY,OAAO,OAAO,WAAW,SAAUA,MAAK;AAAE,WAAO,OAAOA;AAAA,EAAK,IAAI,SAAUA,MAAK;AAAE,WAAOA,QAAO,cAAc,OAAO,UAAUA,KAAI,gBAAgB,UAAUA,SAAQ,OAAO,YAAY,WAAW,OAAOA;AAAA,EAAK,GAAG,QAAQ,GAAG;AAAG;AAC/U,SAAS,QAAQ,QAAQ,gBAAgB;AAAE,MAAI,OAAO,OAAO,KAAK,MAAM;AAAG,MAAI,OAAO,uBAAuB;AAAE,QAAI,UAAU,OAAO,sBAAsB,MAAM;AAAG,uBAAmB,UAAU,QAAQ,OAAO,SAAU,KAAK;AAAE,aAAO,OAAO,yBAAyB,QAAQ,GAAG,EAAE;AAAA,IAAY,CAAC,IAAI,KAAK,KAAK,MAAM,MAAM,OAAO;AAAA,EAAG;AAAE,SAAO;AAAM;AACpV,SAAS,cAAc,QAAQ;AAAE,WAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AAAE,QAAI,SAAS,QAAQ,UAAU,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC;AAAG,QAAI,IAAI,QAAQ,OAAO,MAAM,GAAG,IAAE,EAAE,QAAQ,SAAU,KAAK;AAAE,sBAAgB,QAAQ,KAAK,OAAO,GAAG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"]
|
|
4
|
+
"sourcesContent": ["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); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _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, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $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 defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(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; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(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); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), 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, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), 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 (val) { var object = Object(val), 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; }\nfunction 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); } }\nfunction _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); }); }; }\n/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:02:40\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from \"../useAuthConfig.mjs\";\nimport { useKeycloak as useReactKeycloak } from '@bitspur/react-keycloak-web';\nimport { useKeycloak as useSsrKeycloak } from '@bitspur/react-keycloak-ssr';\nexport function useKeycloak() {\n var authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) {\n return new Keycloak({\n email: 'storybook@example.com',\n login: function () {\n var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n return _context.abrupt(\"return\", undefined);\n case 1:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n function login() {\n return _login.apply(this, arguments);\n }\n return login;\n }(),\n logout: function () {\n var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n return _context2.abrupt(\"return\", undefined);\n case 1:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2);\n }));\n function logout() {\n return _logout.apply(this, arguments);\n }\n return logout;\n }(),\n subject: '0',\n username: 'storybook'\n }, true);\n }\n if (MultiPlatform.isNext && authConfig.ssr) {\n var _useSsrKeycloak = useSsrKeycloak(),\n _keycloak = _useSsrKeycloak.keycloak,\n _initialized = _useSsrKeycloak.initialized;\n return new Keycloak(_keycloak, _initialized);\n }\n var _useReactKeycloak = useReactKeycloak(),\n keycloak = _useReactKeycloak.keycloak,\n initialized = _useReactKeycloak.initialized;\n return new Keycloak(keycloak, initialized);\n}\nexport var Keycloak = /*#__PURE__*/function () {\n function Keycloak(keycloak, initialized) {\n _classCallCheck(this, Keycloak);\n this.keycloak = keycloak;\n this.authenticated = initialized ? keycloak === null || keycloak === void 0 ? void 0 : keycloak.authenticated : undefined;\n }\n _createClass(Keycloak, [{\n key: \"idToken\",\n get: function get() {\n var _this$keycloak;\n return (_this$keycloak = this.keycloak) === null || _this$keycloak === void 0 ? void 0 : _this$keycloak.idToken;\n }\n }, {\n key: \"realmAccess\",\n get: function get() {\n var _this$keycloak2;\n return (_this$keycloak2 = this.keycloak) === null || _this$keycloak2 === void 0 ? void 0 : _this$keycloak2.realmAccess;\n }\n }, {\n key: \"refreshToken\",\n get: function get() {\n var _this$keycloak3;\n return (_this$keycloak3 = this.keycloak) === null || _this$keycloak3 === void 0 ? void 0 : _this$keycloak3.refreshToken;\n }\n }, {\n key: \"refreshTokenParsed\",\n get: function get() {\n var _this$keycloak4;\n return (_this$keycloak4 = this.keycloak) === null || _this$keycloak4 === void 0 ? void 0 : _this$keycloak4.refreshTokenParsed;\n }\n }, {\n key: \"resourceAccess\",\n get: function get() {\n var _this$keycloak5;\n return (_this$keycloak5 = this.keycloak) === null || _this$keycloak5 === void 0 ? void 0 : _this$keycloak5.resourceAccess;\n }\n }, {\n key: \"subject\",\n get: function get() {\n var _this$keycloak6;\n return (_this$keycloak6 = this.keycloak) === null || _this$keycloak6 === void 0 ? void 0 : _this$keycloak6.subject;\n }\n }, {\n key: \"token\",\n get: function get() {\n var _this$keycloak7;\n return (_this$keycloak7 = this.keycloak) === null || _this$keycloak7 === void 0 ? void 0 : _this$keycloak7.token;\n }\n }, {\n key: \"tokenParsed\",\n get: function get() {\n var _this$keycloak8;\n return (_this$keycloak8 = this.keycloak) === null || _this$keycloak8 === void 0 ? void 0 : _this$keycloak8.tokenParsed;\n }\n }, {\n key: \"email\",\n get: function get() {\n var _this$keycloak9, _this$keycloak9$token;\n return (_this$keycloak9 = this.keycloak) === null || _this$keycloak9 === void 0 ? void 0 : (_this$keycloak9$token = _this$keycloak9.tokenParsed) === null || _this$keycloak9$token === void 0 ? void 0 : _this$keycloak9$token.email;\n }\n }, {\n key: \"username\",\n get: function get() {\n var _this$keycloak10, _this$keycloak10$toke;\n return (_this$keycloak10 = this.keycloak) === null || _this$keycloak10 === void 0 ? void 0 : (_this$keycloak10$toke = _this$keycloak10.tokenParsed) === null || _this$keycloak10$toke === void 0 ? void 0 : _this$keycloak10$toke.preferred_username;\n }\n }, {\n key: \"login\",\n value: function () {\n var _login2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n if (this.keycloak) {\n _context3.next = 2;\n break;\n }\n return _context3.abrupt(\"return\");\n case 2:\n return _context3.abrupt(\"return\", this.keycloak.login());\n case 3:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function login() {\n return _login2.apply(this, arguments);\n }\n return login;\n }()\n }, {\n key: \"logout\",\n value: function () {\n var _logout2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n if (this.keycloak) {\n _context4.next = 2;\n break;\n }\n return _context4.abrupt(\"return\");\n case 2:\n return _context4.abrupt(\"return\", this.keycloak.logout());\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function logout() {\n return _logout2.apply(this, arguments);\n }\n return logout;\n }()\n }]);\n return Keyclo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,eAAS,SAAS;AAChB,eAAO,SAAS,MAAM,MAAM,SAAS;AAAA,MACvC;AACA,aAAO;AAAA,IACT,EAAE;AAAA,EACJ,CAAC,CAAC;AACF,SAAOA;AACT,EAAE;",
|
|
6
|
+
"names": ["obj", "_regeneratorRuntime", "define", "value", "next", "key", "Keycloak"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.native.ts"],
|
|
4
|
-
"sourcesContent": ["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); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
4
|
+
"sourcesContent": ["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); }\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return _typeof(key) === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (_typeof(res) !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:04:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport atob from 'core-js-pure/stable/atob';\nimport escape from 'core-js-pure/stable/escape';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useKeycloak as useExpoKeycloak } from 'expo-keycloak-auth';\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return {\n authenticated: true\n };\n var _useExpoKeycloak = useExpoKeycloak(),\n ready = _useExpoKeycloak.ready,\n login = _useExpoKeycloak.login,\n isLoggedIn = _useExpoKeycloak.isLoggedIn,\n token = _useExpoKeycloak.token,\n logout = _useExpoKeycloak.logout,\n refreshToken = _useExpoKeycloak.refreshToken;\n var keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);\n return keycloak;\n}\nexport var ExpoKeycloak = /*#__PURE__*/_createClass(function ExpoKeycloak(ready, isLoggedIn, login, logout, token, refreshToken) {\n _classCallCheck(this, ExpoKeycloak);\n this.logout = logout;\n this.token = token;\n this.refreshToken = refreshToken;\n if (ready) this.authenticated = isLoggedIn;\n if (this.authenticated) {\n if (this.token) this.tokenParsed = decodeToken(this.token);\n if (this.refreshToken) {\n this.refreshTokenParsed = decodeToken(this.refreshToken);\n }\n if (this.tokenParsed) {\n this.subject = this.tokenParsed.sub;\n this.realmAccess = this.tokenParsed.realm_access;\n this.resourceAccess = this.tokenParsed.resource_access;\n }\n }\n this.login = function () {\n return login();\n };\n});\nfunction decodeToken(str) {\n str = str.split('.')[1];\n str = str.replace(/-/g, '+');\n str = str.replace(/_/g, '/');\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += '==';\n break;\n case 3:\n str += '=';\n break;\n default:\n throw 'Invalid token';\n }\n str = decodeURIComponent(escape(atob(str)));\n str = JSON.parse(str);\n return str;\n}"],
|
|
5
5
|
"mappings": "AAAA,SAAS,QAAQ,KAAK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H;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF;AACE,YAAM;AAAA,EACV;AACA,QAAM,mBAAmB,OAAO,KAAK,GAAG,CAAC,CAAC;AAC1C,QAAM,KAAK,MAAM,GAAG;AACpB,SAAO;AACT;",
|
|
6
6
|
"names": ["obj", "ExpoKeycloak"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 13:55:42\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nexport * from './useKeycloak';\n\nexport interface IKeycloak {\n authenticated?: boolean;\n idToken?: string;\n realmAccess?: KeycloakRoles;\n refreshToken?: string;\n refreshTokenParsed?: KeycloakTokenParsed;\n resourceAccess?: KeycloakResourceAccess;\n subject?: string;\n token?: string;\n tokenParsed?: ITokenParsed;\n email?: string;\n username?: string;\n login: () => Promise<unknown>;\n logout: () => Promise<unknown>;\n}\n\nexport interface ITokenParsed extends KeycloakTokenParsed {\n 'allowed-origins'?: string[];\n email_verified?: boolean;\n preferred_username?: string;\n scope?: string;\n sid?: string;\n}\n"],
|
|
5
5
|
"mappings": "AAyBA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -5,28 +5,72 @@ import { useKeycloak as useSsrKeycloak } from "@bitspur/react-keycloak-ssr";
|
|
|
5
5
|
function useKeycloak() {
|
|
6
6
|
const authConfig = useAuthConfig();
|
|
7
7
|
if (MultiPlatform.isStorybook) {
|
|
8
|
-
return
|
|
8
|
+
return new Keycloak(
|
|
9
|
+
{
|
|
10
|
+
email: "storybook@example.com",
|
|
11
|
+
login: async () => void 0,
|
|
12
|
+
logout: async () => void 0,
|
|
13
|
+
subject: "0",
|
|
14
|
+
username: "storybook"
|
|
15
|
+
},
|
|
16
|
+
true
|
|
17
|
+
);
|
|
9
18
|
}
|
|
10
19
|
if (MultiPlatform.isNext && authConfig.ssr) {
|
|
11
20
|
const { keycloak: keycloak2, initialized: initialized2 } = useSsrKeycloak();
|
|
12
|
-
return
|
|
13
|
-
...keycloak2,
|
|
14
|
-
authenticated: initialized2 ? keycloak2?.authenticated : void 0,
|
|
15
|
-
email: keycloak2?.tokenParsed?.email,
|
|
16
|
-
userId: keycloak2?.tokenParsed?.sub,
|
|
17
|
-
username: keycloak2?.tokenParsed?.preferred_username
|
|
18
|
-
};
|
|
21
|
+
return new Keycloak(keycloak2, initialized2);
|
|
19
22
|
}
|
|
20
23
|
const { keycloak, initialized } = useReactKeycloak();
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
24
|
+
return new Keycloak(keycloak, initialized);
|
|
25
|
+
}
|
|
26
|
+
class Keycloak {
|
|
27
|
+
constructor(keycloak, initialized) {
|
|
28
|
+
this.keycloak = keycloak;
|
|
29
|
+
this.authenticated = initialized ? keycloak?.authenticated : void 0;
|
|
30
|
+
}
|
|
31
|
+
get idToken() {
|
|
32
|
+
return this.keycloak?.idToken;
|
|
33
|
+
}
|
|
34
|
+
get realmAccess() {
|
|
35
|
+
return this.keycloak?.realmAccess;
|
|
36
|
+
}
|
|
37
|
+
get refreshToken() {
|
|
38
|
+
return this.keycloak?.refreshToken;
|
|
39
|
+
}
|
|
40
|
+
get refreshTokenParsed() {
|
|
41
|
+
return this.keycloak?.refreshTokenParsed;
|
|
42
|
+
}
|
|
43
|
+
get resourceAccess() {
|
|
44
|
+
return this.keycloak?.resourceAccess;
|
|
45
|
+
}
|
|
46
|
+
get subject() {
|
|
47
|
+
return this.keycloak?.subject;
|
|
48
|
+
}
|
|
49
|
+
get token() {
|
|
50
|
+
return this.keycloak?.token;
|
|
51
|
+
}
|
|
52
|
+
get tokenParsed() {
|
|
53
|
+
return this.keycloak?.tokenParsed;
|
|
54
|
+
}
|
|
55
|
+
get email() {
|
|
56
|
+
return this.keycloak?.tokenParsed?.email;
|
|
57
|
+
}
|
|
58
|
+
get username() {
|
|
59
|
+
return this.keycloak?.tokenParsed?.preferred_username;
|
|
60
|
+
}
|
|
61
|
+
async login() {
|
|
62
|
+
if (!this.keycloak)
|
|
63
|
+
return;
|
|
64
|
+
return this.keycloak.login();
|
|
65
|
+
}
|
|
66
|
+
async logout() {
|
|
67
|
+
if (!this.keycloak)
|
|
68
|
+
return;
|
|
69
|
+
return this.keycloak.logout();
|
|
70
|
+
}
|
|
28
71
|
}
|
|
29
72
|
export {
|
|
73
|
+
Keycloak,
|
|
30
74
|
useKeycloak
|
|
31
75
|
};
|
|
32
76
|
//# sourceMappingURL=useKeycloak.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
5
|
-
"mappings": "AAyBA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,wBAAwB;AAChD,SAAS,eAAe,sBAAsB;AAEvC,SAAS,cAAc;AAC5B,QAAM,aAAa,cAAc;AACjC,MAAI,cAAc,aAAa;AAC7B,WAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:02:40\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IKeycloak } from './index';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from '../useAuthConfig';\nimport { useKeycloak as useReactKeycloak } from '@bitspur/react-keycloak-web';\nimport { useKeycloak as useSsrKeycloak } from '@bitspur/react-keycloak-ssr';\n\nexport function useKeycloak() {\n const authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) {\n return new Keycloak(\n {\n email: 'storybook@example.com',\n login: async () => undefined,\n logout: async () => undefined,\n subject: '0',\n username: 'storybook',\n },\n true,\n );\n }\n if (MultiPlatform.isNext && authConfig.ssr) {\n const { keycloak, initialized } = useSsrKeycloak();\n return new Keycloak(keycloak, initialized);\n }\n const { keycloak, initialized } = useReactKeycloak();\n return new Keycloak(keycloak, initialized);\n}\n\nexport class Keycloak implements IKeycloak {\n authenticated?: boolean;\n\n constructor(private readonly keycloak: IKeycloak | undefined, initialized: boolean) {\n this.authenticated = initialized ? keycloak?.authenticated : undefined;\n }\n\n get idToken() {\n return this.keycloak?.idToken;\n }\n\n get realmAccess() {\n return this.keycloak?.realmAccess;\n }\n\n get refreshToken() {\n return this.keycloak?.refreshToken;\n }\n\n get refreshTokenParsed() {\n return this.keycloak?.refreshTokenParsed;\n }\n\n get resourceAccess() {\n return this.keycloak?.resourceAccess;\n }\n\n get subject() {\n return this.keycloak?.subject;\n }\n\n get token() {\n return this.keycloak?.token;\n }\n\n get tokenParsed() {\n return this.keycloak?.tokenParsed;\n }\n\n get email() {\n return this.keycloak?.tokenParsed?.email;\n }\n\n get username() {\n return this.keycloak?.tokenParsed?.preferred_username;\n }\n\n async login() {\n if (!this.keycloak) return;\n return this.keycloak.login();\n }\n\n async logout() {\n if (!this.keycloak) return;\n return this.keycloak.logout();\n }\n}\n"],
|
|
5
|
+
"mappings": "AAyBA,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,eAAe,wBAAwB;AAChD,SAAS,eAAe,sBAAsB;AAEvC,SAAS,cAAc;AAC5B,QAAM,aAAa,cAAc;AACjC,MAAI,cAAc,aAAa;AAC7B,WAAO,IAAI;AAAA,MACT;AAAA,QACE,OAAO;AAAA,QACP,OAAO,YAAY;AAAA,QACnB,QAAQ,YAAY;AAAA,QACpB,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,cAAc,UAAU,WAAW,KAAK;AAC1C,UAAM,EAAE,UAAAA,WAAU,aAAAC,aAAY,IAAI,eAAe;AACjD,WAAO,IAAI,SAASD,WAAUC,YAAW;AAAA,EAC3C;AACA,QAAM,EAAE,UAAU,YAAY,IAAI,iBAAiB;AACnD,SAAO,IAAI,SAAS,UAAU,WAAW;AAC3C;AAEO,MAAM,SAA8B;AAAA,EAGzC,YAA6B,UAAiC,aAAsB;AAAvD;AAC3B,SAAK,gBAAgB,cAAc,UAAU,gBAAgB;AAAA,EAC/D;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,qBAAqB;AACvB,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,iBAAiB;AACnB,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,UAAU;AACZ,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AAChB,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AACV,WAAO,KAAK,UAAU,aAAa;AAAA,EACrC;AAAA,EAEA,IAAI,WAAW;AACb,WAAO,KAAK,UAAU,aAAa;AAAA,EACrC;AAAA,EAEA,MAAM,QAAQ;AACZ,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,MAAM;AAAA,EAC7B;AAAA,EAEA,MAAM,SAAS;AACb,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,OAAO;AAAA,EAC9B;AACF;",
|
|
6
6
|
"names": ["keycloak", "initialized"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.native.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:04:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport atob from 'core-js-pure/stable/atob';\nimport escape from 'core-js-pure/stable/escape';\nimport type { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';\nimport type { IKeycloak } from './index';\nimport type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useKeycloak as useExpoKeycloak } from 'expo-keycloak-auth';\n\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n const { ready, login, isLoggedIn, token, logout, refreshToken } = useExpoKeycloak();\n const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);\n return keycloak as IKeycloak;\n}\n\nexport class ExpoKeycloak implements IKeycloak {\n authenticated?: boolean;\n\n tokenParsed?: KeycloakTokenParsed;\n\n refreshTokenParsed?: KeycloakTokenParsed;\n\n subject?: string;\n\n realmAccess?: KeycloakRoles;\n\n resourceAccess?: KeycloakResourceAccess;\n\n login: () => Promise<unknown>;\n\n constructor(\n ready: boolean,\n isLoggedIn: boolean | undefined,\n login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>,\n public logout: () => Promise<unknown>,\n public token?: string,\n public refreshToken?: string,\n ) {\n if (ready) this.authenticated = isLoggedIn;\n if (this.authenticated) {\n if (this.token) this.tokenParsed = decodeToken(this.token);\n if (this.refreshToken) {\n this.refreshTokenParsed = decodeToken(this.refreshToken);\n }\n if (this.tokenParsed) {\n this.subject = this.tokenParsed.sub;\n this.realmAccess = this.tokenParsed.realm_access;\n this.resourceAccess = this.tokenParsed.resource_access;\n }\n }\n this.login = () => login();\n }\n}\n\nfunction decodeToken(str: string) {\n str = str.split('.')[1];\n str = str.replace(/-/g, '+');\n str = str.replace(/_/g, '/');\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += '==';\n break;\n case 3:\n str += '=';\n break;\n default:\n throw 'Invalid token';\n }\n str = decodeURIComponent(escape(atob(str)));\n str = JSON.parse(str);\n return str as unknown as KeycloakTokenParsed;\n}\n"],
|
|
5
5
|
"mappings": "AAwBA,OAAO,UAAU;AACjB,OAAO,YAAY;AAInB,SAAS,qBAAqB;AAC9B,SAAS,eAAe,uBAAuB;AAExC,SAAS,cAAc;AAC5B,MAAI,cAAc;AAAa,WAAO,EAAE,eAAe,KAAK;AAC5D,QAAM,EAAE,OAAO,OAAO,YAAY,OAAO,QAAQ,aAAa,IAAI,gBAAgB;AAClF,QAAM,WAAW,IAAI,aAAa,OAAO,YAAY,OAAO,QAAQ,SAAS,QAAW,gBAAgB,MAAS;AACjH,SAAO;AACT;AAEO,MAAM,aAAkC;AAAA,EAe7C,YACE,OACA,YACA,OACO,QACA,OACA,cACP;AAHO;AACA;AACA;AAEP,QAAI;AAAO,WAAK,gBAAgB;AAChC,QAAI,KAAK,eAAe;AACtB,UAAI,KAAK;AAAO,aAAK,cAAc,YAAY,KAAK,KAAK;AACzD,UAAI,KAAK,cAAc;AACrB,aAAK,qBAAqB,YAAY,KAAK,YAAY;AAAA,MACzD;AACA,UAAI,KAAK,aAAa;AACpB,aAAK,UAAU,KAAK,YAAY;AAChC,aAAK,cAAc,KAAK,YAAY;AACpC,aAAK,iBAAiB,KAAK,YAAY;AAAA,MACzC;AAAA,IACF;AACA,SAAK,QAAQ,MAAM,MAAM;AAAA,EAC3B;AACF;AAEA,SAAS,YAAY,KAAa;AAChC,QAAM,IAAI,MAAM,GAAG,EAAE,CAAC;AACtB,QAAM,IAAI,QAAQ,MAAM,GAAG;AAC3B,QAAM,IAAI,QAAQ,MAAM,GAAG;AAC3B,UAAQ,IAAI,SAAS,GAAG;AAAA,IACtB,KAAK;AACH;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF,KAAK;AACH,aAAO;AACP;AAAA,IACF;AACE,YAAM;AAAA,EACV;AACA,QAAM,mBAAmB,OAAO,KAAK,GAAG,CAAC,CAAC;AAC1C,QAAM,KAAK,MAAM,GAAG;AACpB,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* File Created: 08-11-2022 14:10:44
|
|
5
5
|
* Author: Clay Risser
|
|
6
6
|
* -----
|
|
7
|
-
* Last Modified:
|
|
7
|
+
* Last Modified: 01-06-2023 13:55:42
|
|
8
8
|
* Modified By: Clay Risser
|
|
9
9
|
* -----
|
|
10
10
|
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
@@ -35,9 +35,8 @@ export interface IKeycloak {
|
|
|
35
35
|
tokenParsed?: ITokenParsed;
|
|
36
36
|
email?: string;
|
|
37
37
|
username?: string;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
logout: () => Promise<unknown> | unknown;
|
|
38
|
+
login: () => Promise<unknown>;
|
|
39
|
+
logout: () => Promise<unknown>;
|
|
41
40
|
}
|
|
42
41
|
export interface ITokenParsed extends KeycloakTokenParsed {
|
|
43
42
|
'allowed-origins'?: string[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/index.ts\n * Project: app\n * File Created: 08-11-2022 14:10:44\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 13:55:42\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nexport * from './useKeycloak';\n\nexport interface IKeycloak {\n authenticated?: boolean;\n idToken?: string;\n realmAccess?: KeycloakRoles;\n refreshToken?: string;\n refreshTokenParsed?: KeycloakTokenParsed;\n resourceAccess?: KeycloakResourceAccess;\n subject?: string;\n token?: string;\n tokenParsed?: ITokenParsed;\n email?: string;\n username?: string;\n login: () => Promise<unknown>;\n logout: () => Promise<unknown>;\n}\n\nexport interface ITokenParsed extends KeycloakTokenParsed {\n 'allowed-origins'?: string[];\n email_verified?: boolean;\n preferred_username?: string;\n scope?: string;\n sid?: string;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAyBA,gCAAc,0BAzBd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* File Created: 08-11-2022 06:04:59
|
|
5
5
|
* Author: Clay Risser
|
|
6
6
|
* -----
|
|
7
|
-
* Last Modified:
|
|
7
|
+
* Last Modified: 01-06-2023 14:02:40
|
|
8
8
|
* Modified By: Clay Risser
|
|
9
9
|
* -----
|
|
10
10
|
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
@@ -22,4 +22,21 @@
|
|
|
22
22
|
* limitations under the License.
|
|
23
23
|
*/
|
|
24
24
|
import type { IKeycloak } from './index';
|
|
25
|
-
export declare function useKeycloak():
|
|
25
|
+
export declare function useKeycloak(): Keycloak;
|
|
26
|
+
export declare class Keycloak implements IKeycloak {
|
|
27
|
+
private readonly keycloak;
|
|
28
|
+
authenticated?: boolean;
|
|
29
|
+
constructor(keycloak: IKeycloak | undefined, initialized: boolean);
|
|
30
|
+
get idToken(): string | undefined;
|
|
31
|
+
get realmAccess(): import("@bitspur/keycloak-js").KeycloakRoles | undefined;
|
|
32
|
+
get refreshToken(): string | undefined;
|
|
33
|
+
get refreshTokenParsed(): import("@bitspur/keycloak-js").KeycloakTokenParsed | undefined;
|
|
34
|
+
get resourceAccess(): import("@bitspur/keycloak-js").KeycloakResourceAccess | undefined;
|
|
35
|
+
get subject(): string | undefined;
|
|
36
|
+
get token(): string | undefined;
|
|
37
|
+
get tokenParsed(): import("./index").ITokenParsed | undefined;
|
|
38
|
+
get email(): any;
|
|
39
|
+
get username(): string | undefined;
|
|
40
|
+
login(): Promise<unknown>;
|
|
41
|
+
logout(): Promise<unknown>;
|
|
42
|
+
}
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __spreadValues = (a, b) => {
|
|
12
|
-
for (var prop in b || (b = {}))
|
|
13
|
-
if (__hasOwnProp.call(b, prop))
|
|
14
|
-
__defNormalProp(a, prop, b[prop]);
|
|
15
|
-
if (__getOwnPropSymbols)
|
|
16
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
-
if (__propIsEnum.call(b, prop))
|
|
18
|
-
__defNormalProp(a, prop, b[prop]);
|
|
19
|
-
}
|
|
20
|
-
return a;
|
|
21
|
-
};
|
|
22
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
6
|
var __export = (target, all) => {
|
|
24
7
|
for (var name in all)
|
|
25
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -35,6 +18,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
35
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
19
|
var useKeycloak_exports = {};
|
|
37
20
|
__export(useKeycloak_exports, {
|
|
21
|
+
Keycloak: () => Keycloak,
|
|
38
22
|
useKeycloak: () => useKeycloak
|
|
39
23
|
});
|
|
40
24
|
module.exports = __toCommonJS(useKeycloak_exports);
|
|
@@ -43,30 +27,85 @@ var import_useAuthConfig = require("../useAuthConfig");
|
|
|
43
27
|
var import_react_keycloak_web = require("@bitspur/react-keycloak-web");
|
|
44
28
|
var import_react_keycloak_ssr = require("@bitspur/react-keycloak-ssr");
|
|
45
29
|
function useKeycloak() {
|
|
46
|
-
var _a, _b, _c, _d, _e, _f;
|
|
47
30
|
const authConfig = (0, import_useAuthConfig.useAuthConfig)();
|
|
48
31
|
if (import_multiplatform.MultiPlatform.isStorybook) {
|
|
49
|
-
return
|
|
32
|
+
return new Keycloak(
|
|
33
|
+
{
|
|
34
|
+
email: "storybook@example.com",
|
|
35
|
+
login: async () => void 0,
|
|
36
|
+
logout: async () => void 0,
|
|
37
|
+
subject: "0",
|
|
38
|
+
username: "storybook"
|
|
39
|
+
},
|
|
40
|
+
true
|
|
41
|
+
);
|
|
50
42
|
}
|
|
51
43
|
if (import_multiplatform.MultiPlatform.isNext && authConfig.ssr) {
|
|
52
44
|
const { keycloak: keycloak2, initialized: initialized2 } = (0, import_react_keycloak_ssr.useKeycloak)();
|
|
53
|
-
return
|
|
54
|
-
authenticated: initialized2 ? keycloak2 == null ? void 0 : keycloak2.authenticated : void 0,
|
|
55
|
-
email: (_a = keycloak2 == null ? void 0 : keycloak2.tokenParsed) == null ? void 0 : _a.email,
|
|
56
|
-
userId: (_b = keycloak2 == null ? void 0 : keycloak2.tokenParsed) == null ? void 0 : _b.sub,
|
|
57
|
-
username: (_c = keycloak2 == null ? void 0 : keycloak2.tokenParsed) == null ? void 0 : _c.preferred_username
|
|
58
|
-
});
|
|
45
|
+
return new Keycloak(keycloak2, initialized2);
|
|
59
46
|
}
|
|
60
47
|
const { keycloak, initialized } = (0, import_react_keycloak_web.useKeycloak)();
|
|
61
|
-
return
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return new Keycloak(keycloak, initialized);
|
|
49
|
+
}
|
|
50
|
+
class Keycloak {
|
|
51
|
+
constructor(keycloak, initialized) {
|
|
52
|
+
this.keycloak = keycloak;
|
|
53
|
+
this.authenticated = initialized ? keycloak == null ? void 0 : keycloak.authenticated : void 0;
|
|
54
|
+
}
|
|
55
|
+
get idToken() {
|
|
56
|
+
var _a;
|
|
57
|
+
return (_a = this.keycloak) == null ? void 0 : _a.idToken;
|
|
58
|
+
}
|
|
59
|
+
get realmAccess() {
|
|
60
|
+
var _a;
|
|
61
|
+
return (_a = this.keycloak) == null ? void 0 : _a.realmAccess;
|
|
62
|
+
}
|
|
63
|
+
get refreshToken() {
|
|
64
|
+
var _a;
|
|
65
|
+
return (_a = this.keycloak) == null ? void 0 : _a.refreshToken;
|
|
66
|
+
}
|
|
67
|
+
get refreshTokenParsed() {
|
|
68
|
+
var _a;
|
|
69
|
+
return (_a = this.keycloak) == null ? void 0 : _a.refreshTokenParsed;
|
|
70
|
+
}
|
|
71
|
+
get resourceAccess() {
|
|
72
|
+
var _a;
|
|
73
|
+
return (_a = this.keycloak) == null ? void 0 : _a.resourceAccess;
|
|
74
|
+
}
|
|
75
|
+
get subject() {
|
|
76
|
+
var _a;
|
|
77
|
+
return (_a = this.keycloak) == null ? void 0 : _a.subject;
|
|
78
|
+
}
|
|
79
|
+
get token() {
|
|
80
|
+
var _a;
|
|
81
|
+
return (_a = this.keycloak) == null ? void 0 : _a.token;
|
|
82
|
+
}
|
|
83
|
+
get tokenParsed() {
|
|
84
|
+
var _a;
|
|
85
|
+
return (_a = this.keycloak) == null ? void 0 : _a.tokenParsed;
|
|
86
|
+
}
|
|
87
|
+
get email() {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
return (_b = (_a = this.keycloak) == null ? void 0 : _a.tokenParsed) == null ? void 0 : _b.email;
|
|
90
|
+
}
|
|
91
|
+
get username() {
|
|
92
|
+
var _a, _b;
|
|
93
|
+
return (_b = (_a = this.keycloak) == null ? void 0 : _a.tokenParsed) == null ? void 0 : _b.preferred_username;
|
|
94
|
+
}
|
|
95
|
+
async login() {
|
|
96
|
+
if (!this.keycloak)
|
|
97
|
+
return;
|
|
98
|
+
return this.keycloak.login();
|
|
99
|
+
}
|
|
100
|
+
async logout() {
|
|
101
|
+
if (!this.keycloak)
|
|
102
|
+
return;
|
|
103
|
+
return this.keycloak.logout();
|
|
104
|
+
}
|
|
67
105
|
}
|
|
68
106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
69
107
|
0 && (module.exports = {
|
|
108
|
+
Keycloak,
|
|
70
109
|
useKeycloak
|
|
71
110
|
});
|
|
72
111
|
//# sourceMappingURL=useKeycloak.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.ts\n * Project: app\n * File Created: 08-11-2022 06:04:59\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:02:40\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { IKeycloak } from './index';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useAuthConfig } from '../useAuthConfig';\nimport { useKeycloak as useReactKeycloak } from '@bitspur/react-keycloak-web';\nimport { useKeycloak as useSsrKeycloak } from '@bitspur/react-keycloak-ssr';\n\nexport function useKeycloak() {\n const authConfig = useAuthConfig();\n if (MultiPlatform.isStorybook) {\n return new Keycloak(\n {\n email: 'storybook@example.com',\n login: async () => undefined,\n logout: async () => undefined,\n subject: '0',\n username: 'storybook',\n },\n true,\n );\n }\n if (MultiPlatform.isNext && authConfig.ssr) {\n const { keycloak, initialized } = useSsrKeycloak();\n return new Keycloak(keycloak, initialized);\n }\n const { keycloak, initialized } = useReactKeycloak();\n return new Keycloak(keycloak, initialized);\n}\n\nexport class Keycloak implements IKeycloak {\n authenticated?: boolean;\n\n constructor(private readonly keycloak: IKeycloak | undefined, initialized: boolean) {\n this.authenticated = initialized ? keycloak?.authenticated : undefined;\n }\n\n get idToken() {\n return this.keycloak?.idToken;\n }\n\n get realmAccess() {\n return this.keycloak?.realmAccess;\n }\n\n get refreshToken() {\n return this.keycloak?.refreshToken;\n }\n\n get refreshTokenParsed() {\n return this.keycloak?.refreshTokenParsed;\n }\n\n get resourceAccess() {\n return this.keycloak?.resourceAccess;\n }\n\n get subject() {\n return this.keycloak?.subject;\n }\n\n get token() {\n return this.keycloak?.token;\n }\n\n get tokenParsed() {\n return this.keycloak?.tokenParsed;\n }\n\n get email() {\n return this.keycloak?.tokenParsed?.email;\n }\n\n get username() {\n return this.keycloak?.tokenParsed?.preferred_username;\n }\n\n async login() {\n if (!this.keycloak) return;\n return this.keycloak.login();\n }\n\n async logout() {\n if (!this.keycloak) return;\n return this.keycloak.logout();\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBA,2BAA8B;AAC9B,2BAA8B;AAC9B,gCAAgD;AAChD,gCAA8C;AAEvC,SAAS,cAAc;AAC5B,QAAM,iBAAa,oCAAc;AACjC,MAAI,mCAAc,aAAa;AAC7B,WAAO,IAAI;AAAA,MACT;AAAA,QACE,OAAO;AAAA,QACP,OAAO,YAAY;AAAA,QACnB,QAAQ,YAAY;AAAA,QACpB,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,mCAAc,UAAU,WAAW,KAAK;AAC1C,UAAM,EAAE,UAAAA,WAAU,aAAAC,aAAY,QAAI,0BAAAC,aAAe;AACjD,WAAO,IAAI,SAASF,WAAUC,YAAW;AAAA,EAC3C;AACA,QAAM,EAAE,UAAU,YAAY,QAAI,0BAAAE,aAAiB;AACnD,SAAO,IAAI,SAAS,UAAU,WAAW;AAC3C;AAEO,MAAM,SAA8B;AAAA,EAGzC,YAA6B,UAAiC,aAAsB;AAAvD;AAC3B,SAAK,gBAAgB,cAAc,qCAAU,gBAAgB;AAAA,EAC/D;AAAA,EAEA,IAAI,UAAU;AA3DhB;AA4DI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AA/DpB;AAgEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,eAAe;AAnErB;AAoEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,qBAAqB;AAvE3B;AAwEI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,iBAAiB;AA3EvB;AA4EI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,UAAU;AA/EhB;AAgFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AAnFd;AAoFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,cAAc;AAvFpB;AAwFI,YAAO,UAAK,aAAL,mBAAe;AAAA,EACxB;AAAA,EAEA,IAAI,QAAQ;AA3Fd;AA4FI,YAAO,gBAAK,aAAL,mBAAe,gBAAf,mBAA4B;AAAA,EACrC;AAAA,EAEA,IAAI,WAAW;AA/FjB;AAgGI,YAAO,gBAAK,aAAL,mBAAe,gBAAf,mBAA4B;AAAA,EACrC;AAAA,EAEA,MAAM,QAAQ;AACZ,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,MAAM;AAAA,EAC7B;AAAA,EAEA,MAAM,SAAS;AACb,QAAI,CAAC,KAAK;AAAU;AACpB,WAAO,KAAK,SAAS,OAAO;AAAA,EAC9B;AACF;",
|
|
6
6
|
"names": ["keycloak", "initialized", "useSsrKeycloak", "useReactKeycloak"]
|
|
7
7
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* File Created: 08-11-2022 14:10:25
|
|
5
5
|
* Author: Clay Risser
|
|
6
6
|
* -----
|
|
7
|
-
* Last Modified:
|
|
7
|
+
* Last Modified: 01-06-2023 14:04:46
|
|
8
8
|
* Modified By: Clay Risser
|
|
9
9
|
* -----
|
|
10
10
|
* Risser Labs LLC (c) Copyright 2021 - 2022
|
|
@@ -26,7 +26,7 @@ import type { IKeycloak } from './index';
|
|
|
26
26
|
import type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';
|
|
27
27
|
export declare function useKeycloak(): IKeycloak;
|
|
28
28
|
export declare class ExpoKeycloak implements IKeycloak {
|
|
29
|
-
logout: () => unknown
|
|
29
|
+
logout: () => Promise<unknown>;
|
|
30
30
|
token?: string | undefined;
|
|
31
31
|
refreshToken?: string | undefined;
|
|
32
32
|
authenticated?: boolean;
|
|
@@ -35,6 +35,6 @@ export declare class ExpoKeycloak implements IKeycloak {
|
|
|
35
35
|
subject?: string;
|
|
36
36
|
realmAccess?: KeycloakRoles;
|
|
37
37
|
resourceAccess?: KeycloakResourceAccess;
|
|
38
|
-
login: () => Promise<unknown
|
|
39
|
-
constructor(ready: boolean, isLoggedIn: boolean | undefined, login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>, logout: () => unknown
|
|
38
|
+
login: () => Promise<unknown>;
|
|
39
|
+
constructor(ready: boolean, isLoggedIn: boolean | undefined, login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>, logout: () => Promise<unknown>, token?: string | undefined, refreshToken?: string | undefined);
|
|
40
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/hooks/useKeycloak/useKeycloak.native.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified:
|
|
4
|
+
"sourcesContent": ["/**\n * File: /src/hooks/useKeycloak/useKeycloak.native.ts\n * Project: app\n * File Created: 08-11-2022 14:10:25\n * Author: Clay Risser\n * -----\n * Last Modified: 01-06-2023 14:04:46\n * Modified By: Clay Risser\n * -----\n * Risser Labs LLC (c) Copyright 2021 - 2022\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport atob from 'core-js-pure/stable/atob';\nimport escape from 'core-js-pure/stable/escape';\nimport type { AuthRequestPromptOptions, AuthSessionResult } from 'expo-auth-session';\nimport type { IKeycloak } from './index';\nimport type { KeycloakResourceAccess, KeycloakRoles, KeycloakTokenParsed } from '@bitspur/keycloak-js';\nimport { MultiPlatform } from 'multiplatform.one';\nimport { useKeycloak as useExpoKeycloak } from 'expo-keycloak-auth';\n\nexport function useKeycloak() {\n if (MultiPlatform.isStorybook) return { authenticated: true } as IKeycloak;\n const { ready, login, isLoggedIn, token, logout, refreshToken } = useExpoKeycloak();\n const keycloak = new ExpoKeycloak(ready, isLoggedIn, login, logout, token || undefined, refreshToken || undefined);\n return keycloak as IKeycloak;\n}\n\nexport class ExpoKeycloak implements IKeycloak {\n authenticated?: boolean;\n\n tokenParsed?: KeycloakTokenParsed;\n\n refreshTokenParsed?: KeycloakTokenParsed;\n\n subject?: string;\n\n realmAccess?: KeycloakRoles;\n\n resourceAccess?: KeycloakResourceAccess;\n\n login: () => Promise<unknown>;\n\n constructor(\n ready: boolean,\n isLoggedIn: boolean | undefined,\n login: (options?: AuthRequestPromptOptions) => Promise<AuthSessionResult | undefined>,\n public logout: () => Promise<unknown>,\n public token?: string,\n public refreshToken?: string,\n ) {\n if (ready) this.authenticated = isLoggedIn;\n if (this.authenticated) {\n if (this.token) this.tokenParsed = decodeToken(this.token);\n if (this.refreshToken) {\n this.refreshTokenParsed = decodeToken(this.refreshToken);\n }\n if (this.tokenParsed) {\n this.subject = this.tokenParsed.sub;\n this.realmAccess = this.tokenParsed.realm_access;\n this.resourceAccess = this.tokenParsed.resource_access;\n }\n }\n this.login = () => login();\n }\n}\n\nfunction decodeToken(str: string) {\n str = str.split('.')[1];\n str = str.replace(/-/g, '+');\n str = str.replace(/_/g, '/');\n switch (str.length % 4) {\n case 0:\n break;\n case 2:\n str += '==';\n break;\n case 3:\n str += '=';\n break;\n default:\n throw 'Invalid token';\n }\n str = decodeURIComponent(escape(atob(str)));\n str = JSON.parse(str);\n return str as unknown as KeycloakTokenParsed;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBA,kBAAiB;AACjB,oBAAmB;AAInB,2BAA8B;AAC9B,gCAA+C;AAExC,SAAS,cAAc;AAC5B,MAAI,mCAAc;AAAa,WAAO,EAAE,eAAe,KAAK;AAC5D,QAAM,EAAE,OAAO,OAAO,YAAY,OAAO,QAAQ,aAAa,QAAI,0BAAAA,aAAgB;AAClF,QAAM,WAAW,IAAI,aAAa,OAAO,YAAY,OAAO,QAAQ,SAAS,QAAW,gBAAgB,MAAS;AACjH,SAAO;AACT;AAEO,MAAM,aAAkC;AAAA,EAe7C,YACE,OACA,YACA,OACO,QACA,OACA,cACP;AAHO;AACA;AACA;AAEP,QAAI;AAAO,WAAK,gBAAgB;AAChC,QAAI,KAAK,eAAe;AACtB,UAAI,KAAK;AAAO,aAAK,cAAc,YAAY,KAAK,KAAK;AACzD,UAAI,KAAK,cAAc;AACrB,aAAK,qBAAqB,YAAY,KAAK,YAAY;AAAA,MACzD;AACA,UAAI,KAAK,aAAa;AACpB,aAAK,UAAU,KAAK,YAAY;AAChC,aAAK,cAAc,KAAK,YAAY;AACpC,aAAK,iBAAiB,KAAK,YAAY;AAAA,MACzC;AAAA,IACF;AACA,SAAK,QAAQ,MAAM,MAAM;AAAA,EAC3B;AACF;AAEA,SAAS,YAAY,KAAa;AAChC,QAAM,IAAI,MAAM,GAAG,EAAE,CAAC;AACtB,QAAM,IAAI,QAAQ,MAAM,GAAG;AAC3B,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