This commit is contained in:
99
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/AuthenticationPage.js
generated
vendored
Normal file
99
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/AuthenticationPage.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var _base = _interopRequireDefault(require("@emotion/styled/base"));
|
||||
var _react = _interopRequireDefault(require("react"));
|
||||
var _propTypes = _interopRequireDefault(require("prop-types"));
|
||||
var _decapCmsLibAuth = require("decap-cms-lib-auth");
|
||||
var _decapCmsUiDefault = require("decap-cms-ui-default");
|
||||
var _react2 = require("@emotion/react");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _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; }
|
||||
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
||||
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
||||
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
||||
const LoginButtonIcon = /*#__PURE__*/(0, _base.default)(_decapCmsUiDefault.Icon, {
|
||||
target: "e1eykva80",
|
||||
label: "LoginButtonIcon"
|
||||
})(process.env.NODE_ENV === "production" ? {
|
||||
name: "1gnqu05",
|
||||
styles: "margin-right:18px"
|
||||
} : {
|
||||
name: "1gnqu05",
|
||||
styles: "margin-right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oaXMuc2V0U3RhdGUoeyBsb2dpbkVycm9yOiBlcnIudG9TdHJpbmcoKSB9KTtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgdGhpcy5wcm9wcy5vbkxvZ2luKGRhdGEpO1xuICAgIH0pO1xuICB9O1xuXG4gIHJlbmRlcigpIHtcbiAgICBjb25zdCB7IGluUHJvZ3Jlc3MsIGNvbmZpZywgdCB9ID0gdGhpcy5wcm9wcztcbiAgICByZXR1cm4gKFxuICAgICAgPEF1dGhlbnRpY2F0aW9uUGFnZVxuICAgICAgICBvbkxvZ2luPXt0aGlzLmhhbmRsZUxvZ2lufVxuICAgICAgICBsb2dpbkRpc2FibGVkPXtpblByb2dyZXNzfVxuICAgICAgICBsb2dpbkVycm9yTWVzc2FnZT17dGhpcy5zdGF0ZS5sb2dpbkVycm9yfVxuICAgICAgICBsb2dvVXJsPXtjb25maWcubG9nb191cmx9XG4gICAgICAgIHNpdGVVcmw9e2NvbmZpZy5zaXRlX3VybH1cbiAgICAgICAgcmVuZGVyQnV0dG9uQ29udGVudD17KCkgPT4gKFxuICAgICAgICAgIDxSZWFjdC5GcmFnbWVudD5cbiAgICAgICAgICAgIDxMb2dpbkJ1dHRvbkljb24gdHlwZT1cImxpbmtcIiAvPiB7aW5Qcm9ncmVzcyA/IHQoJ2F1dGgubG9nZ2luZ0luJykgOiB0KCdhdXRoLmxvZ2luJyl9XG4gICAgICAgICAgPC9SZWFjdC5GcmFnbWVudD5cbiAgICAgICAgKX1cbiAgICAgICAgdD17dH1cbiAgICAgIC8+XG4gICAgKTtcbiAgfVxufVxuIl19 */",
|
||||
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
||||
});
|
||||
class GenericPKCEAuthenticationPage extends _react.default.Component {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
_defineProperty(this, "state", {});
|
||||
_defineProperty(this, "handleLogin", e => {
|
||||
e.preventDefault();
|
||||
this.auth.authenticate({
|
||||
scope: 'https://api.github.com/repo openid email'
|
||||
}, (err, data) => {
|
||||
if (err) {
|
||||
this.setState({
|
||||
loginError: err.toString()
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.props.onLogin(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
componentDidMount() {
|
||||
const {
|
||||
base_url = '',
|
||||
app_id = '',
|
||||
auth_endpoint = 'oauth2/authorize',
|
||||
auth_token_endpoint = 'oauth2/token'
|
||||
} = this.props.config.backend;
|
||||
this.auth = new _decapCmsLibAuth.PkceAuthenticator({
|
||||
base_url,
|
||||
auth_endpoint,
|
||||
app_id,
|
||||
auth_token_endpoint,
|
||||
auth_token_endpoint_content_type: 'application/x-www-form-urlencoded; charset=utf-8'
|
||||
});
|
||||
// Complete authentication if we were redirected back to from the provider.
|
||||
this.auth.completeAuth((err, data) => {
|
||||
if (err) {
|
||||
this.setState({
|
||||
loginError: err.toString()
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.props.onLogin(data);
|
||||
});
|
||||
}
|
||||
render() {
|
||||
const {
|
||||
inProgress,
|
||||
config,
|
||||
t
|
||||
} = this.props;
|
||||
return (0, _react2.jsx)(_decapCmsUiDefault.AuthenticationPage, {
|
||||
onLogin: this.handleLogin,
|
||||
loginDisabled: inProgress,
|
||||
loginErrorMessage: this.state.loginError,
|
||||
logoUrl: config.logo_url,
|
||||
siteUrl: config.site_url,
|
||||
renderButtonContent: () => (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(LoginButtonIcon, {
|
||||
type: "link"
|
||||
}), " ", inProgress ? t('auth.loggingIn') : t('auth.login')),
|
||||
t: t
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.default = GenericPKCEAuthenticationPage;
|
||||
_defineProperty(GenericPKCEAuthenticationPage, "propTypes", {
|
||||
inProgress: _propTypes.default.bool,
|
||||
config: _propTypes.default.object.isRequired,
|
||||
onLogin: _propTypes.default.func.isRequired,
|
||||
t: _propTypes.default.func.isRequired
|
||||
});
|
||||
57
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/implementation.js
generated
vendored
Normal file
57
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
var React = _interopRequireWildcard(require("react"));
|
||||
var _decapCmsBackendGithub = require("decap-cms-backend-github");
|
||||
var _AuthenticationPage = _interopRequireDefault(require("./AuthenticationPage"));
|
||||
var _react2 = require("@emotion/react");
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
||||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
||||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
||||
class AwsCognitoGitHubProxyBackend extends _decapCmsBackendGithub.GitHubBackend {
|
||||
constructor(config, options = {}) {
|
||||
super(config, options);
|
||||
this.bypassWriteAccessCheckForAppTokens = true;
|
||||
this.tokenKeyword = 'Bearer';
|
||||
}
|
||||
authComponent() {
|
||||
const wrappedAuthenticationPage = props => (0, _react2.jsx)(_AuthenticationPage.default, _extends({}, props, {
|
||||
backend: this
|
||||
}));
|
||||
wrappedAuthenticationPage.displayName = 'AuthenticationPage';
|
||||
return wrappedAuthenticationPage;
|
||||
}
|
||||
async currentUser({
|
||||
token
|
||||
}) {
|
||||
if (!this._currentUserPromise) {
|
||||
this._currentUserPromise = fetch(this.baseUrl + '/oauth2/userInfo', {
|
||||
headers: {
|
||||
Authorization: `${this.tokenKeyword} ${token}`
|
||||
}
|
||||
}).then(async res => {
|
||||
if (res.status == 401) {
|
||||
this.logout();
|
||||
return Promise.reject('Token expired');
|
||||
}
|
||||
const userInfo = await res.json();
|
||||
const owner = this.originRepo.split('/')[1];
|
||||
return {
|
||||
name: userInfo.email,
|
||||
login: owner,
|
||||
avatar_url: `https://github.com/${owner}.png`
|
||||
};
|
||||
});
|
||||
}
|
||||
return this._currentUserPromise;
|
||||
}
|
||||
async getPullRequestAuthor(pullRequest) {
|
||||
var _pullRequest$user;
|
||||
return (_pullRequest$user = pullRequest.user) === null || _pullRequest$user === void 0 ? void 0 : _pullRequest$user.login;
|
||||
}
|
||||
}
|
||||
exports.default = AwsCognitoGitHubProxyBackend;
|
||||
33
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/index.js
generated
vendored
Normal file
33
node_modules/decap-cms-backend-aws-cognito-github-proxy/dist/esm/index.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "API", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _decapCmsBackendGithub.API;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "AuthenticationPage", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _AuthenticationPage.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "AwsCognitoGitHubProxyBackend", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _implementation.default;
|
||||
}
|
||||
});
|
||||
exports.DecapCmsBackendAwsCognitoGithubProxy = void 0;
|
||||
var _decapCmsBackendGithub = require("decap-cms-backend-github");
|
||||
var _implementation = _interopRequireDefault(require("./implementation"));
|
||||
var _AuthenticationPage = _interopRequireDefault(require("./AuthenticationPage"));
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
const DecapCmsBackendAwsCognitoGithubProxy = exports.DecapCmsBackendAwsCognitoGithubProxy = {
|
||||
AwsCognitoGitHubProxyBackend: _implementation.default,
|
||||
API: _decapCmsBackendGithub.API,
|
||||
AuthenticationPage: _AuthenticationPage.default
|
||||
};
|
||||
Reference in New Issue
Block a user