gitlab-auth
Advanced tools
Comparing version 0.1.3 to 0.1.4
"use strict"; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -19,7 +30,9 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
if (auth == null || auth === undefined) | ||
return (react_1.default.createElement(react_1.default.Fragment, null, "No auth information")); | ||
return react_1.default.createElement(react_1.default.Fragment, null, "No auth information"); | ||
console.log("Auth"); | ||
console.log(auth); | ||
if (auth != null && auth.userData == null) { | ||
return (react_1.default.createElement(react_1.default.Fragment, null, | ||
"Waiting for userData / token information... (", | ||
react_1.default.createElement("a", { href: "/logout", onClick: () => auth.signOut(), title: "cancel sign-in" }, "Cancel"), | ||
react_1.default.createElement("a", { href: process.env.PUBLIC_URL + "/logout", onClick: () => auth.signOut(), title: "cancel sign-in" }, "Cancel"), | ||
")")); | ||
@@ -34,9 +47,11 @@ } | ||
}; | ||
const GitlabAuth = (props) => { | ||
const GitlabAuth = (_a) => { | ||
var { host, application_id, redirect_uri, secret, scope = "openid profile email", children } = _a, props = __rest(_a, ["host", "application_id", "redirect_uri", "secret", "scope", "children"]); | ||
// setup oauth usermanager to work with gitlab | ||
const userManager = new oidc_react_1.UserManager({ | ||
authority: props.host, | ||
client_id: props.application_id, | ||
redirect_uri: props.redirect_uri, | ||
scope: props.scope, | ||
authority: host, | ||
client_id: application_id, | ||
redirect_uri: redirect_uri, | ||
client_secret: secret, | ||
scope: scope, | ||
automaticSilentRenew: true, | ||
@@ -46,18 +61,16 @@ response_type: "code", | ||
metadata: { | ||
issuer: props.host, | ||
authorization_endpoint: props.host + "/oauth/authorize", | ||
token_endpoint: props.host + "/oauth/token", | ||
revocation_endpoint: props.host + "/oauth/revoke", | ||
introspection_endpoint: props.host + "/oauth/introspect", | ||
userinfo_endpoint: props.host + "/oauth/userinfo", | ||
jwks_uri: props.host + "/oauth/discovery/keys", | ||
issuer: host, | ||
authorization_endpoint: host + "/oauth/authorize", | ||
token_endpoint: host + "/oauth/token", | ||
revocation_endpoint: host + "/oauth/revoke", | ||
introspection_endpoint: host + "/oauth/introspect", | ||
userinfo_endpoint: host + "/oauth/userinfo", | ||
jwks_uri: host + "/oauth/discovery/keys", | ||
}, | ||
}); | ||
const auth = oidc_react_1.useAuth(); | ||
console.log(auth); | ||
return (react_1.default.createElement(oidc_react_1.AuthProvider, { userManager: userManager, onSignIn: (user) => { | ||
return (react_1.default.createElement(oidc_react_1.AuthProvider, { userManager: userManager, onSignIn: () => { | ||
cleanup(); | ||
} }, | ||
react_1.default.createElement(GitlabAuthContextMaker, { host: props.host }, props.children))); | ||
react_1.default.createElement(GitlabAuthContextMaker, { host: host }, children))); | ||
}; | ||
exports.GitlabAuth = GitlabAuth; |
{ | ||
"name": "gitlab-auth", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "GitLab authorized API application Context", | ||
"main": "build/src/index.js", | ||
"types": "build/src/index.d.ts", | ||
"files": [ | ||
@@ -12,2 +13,4 @@ "/build" | ||
"clean": "tsc --build --clean", | ||
"prepare": "npm run clean", | ||
"prepack": "tsc --build", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -35,2 +38,3 @@ }, | ||
"devDependencies": { | ||
"@types/node": "^14.14.37", | ||
"@types/react": "^17.0.3", | ||
@@ -37,0 +41,0 @@ "typescript": "^4.2.3" |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
20035
12
334
3
1
1