Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth clients: Hide private data from exports #133

Merged
merged 4 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var getCSRFToken = require('./csrf-token');
// We don't want to wait until the token is already expired before refreshing it.
var BEARER_TOKEN_EXPIRATION_ALLOWANCE = 60 * 1000;

module.exports = new Model({
const authClient = new Model({
_currentUserPromise: null,

_bearerToken: '',
Expand Down Expand Up @@ -358,3 +358,17 @@ module.exports = new Model({
}.bind(this));
},
});

module.exports = {
changePassword: authClient.changePassword.bind(authClient),
checkCurrent: authClient.checkCurrent.bind(authClient),
checkBearerToken: authClient.checkBearerToken.bind(authClient),
disableAccount: authClient.disableAccount.bind(authClient),
listen: authClient.listen.bind(authClient),
register: authClient.register.bind(authClient),
requestPasswordReset: authClient.requestPasswordReset.bind(authClient),
signIn: authClient.signIn.bind(authClient),
stopListening: authClient.stopListening.bind(authClient),
signOut: authClient.signOut.bind(authClient),
unsubscribeEmail: authClient.unsubscribeEmail.bind(authClient)
};
12 changes: 11 additions & 1 deletion lib/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var LOCAL_STORAGE_PREFIX = 'panoptesClientOAuth_';
var SESSION_STORAGE = window.localStorage;

// Create our model, then do stuff with it later
module.exports = new Model({
const authClient = new Model({
_bearerRefreshTimeout: NaN,
_clientAppId: ls.get(LOCAL_STORAGE_PREFIX + 'clientAppId'),
_currentSessionCheckPromise: null,
Expand Down Expand Up @@ -312,3 +312,13 @@ function destroyIFrame(iframe) {
iframe.parentNode.removeChild(iframe);
return null;
}

module.exports = {
checkCurrent: authClient.checkCurrent.bind(authClient),
checkBearerToken: authClient.checkBearerToken.bind(authClient),
init: authClient.init.bind(authClient),
listen: authClient.listen.bind(authClient),
stopListening: authClient.stopListening.bind(authClient),
signIn: authClient.signIn.bind(authClient),
signOut: authClient.signOut.bind(authClient)
}