Skip to content

Commit

Permalink
Merge pull request #128 from Cox-Automotive/develop
Browse files Browse the repository at this point in the history
Merge develop to master
  • Loading branch information
webbbarker authored Dec 20, 2019
2 parents 17eae71 + 8f96195 commit 8f0a888
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion bin/alks-developer-login2fa
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var logger = 'dev-login-2fa';
utils.log(program, logger, 'loading developer');
Developer.getDeveloper(function(err, data){
console.error('Opening ALKS 2FA Page.. Be sure to login using Okta..');
opn(data.server.replace(/rest/, 'login/getToken.htm'));
opn(data.server.replace(/rest/, 'token-management'));
console.error('Please copy your refresh token from ALKS and paste below..');

Developer.getPasswordFromPrompt(function(err, refreshToken){
Expand Down
4 changes: 2 additions & 2 deletions bin/alks-developer-logout2fa
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ if(Developer.removeToken()){
console.error(clc.white('Token removed!'));
}
else{
console.error(clc.red.bold('Error removing toking!'));
console.error(clc.red.bold('Error removing token!'));
}

utils.log(program, logger, 'checking for updates');
utils.checkForUpdate();
Developer.trackActivity(logger);
Developer.trackActivity(logger);
21 changes: 13 additions & 8 deletions bin/alks-sessions-console
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var outputValues = utils.getOutputValues();
program
.version(config.version)
.description('open an AWS console in your browser')
.option('-u, --url', 'just print the url')
.option('-o, --openWith [appName]', 'open in a different app (optional)')
.option('-a, --account [alksAccount]', 'alks account to use')
.option('-r, --role [alksRole]', 'alks role to use')
Expand Down Expand Up @@ -62,14 +63,18 @@ var onComplete = function(err, key){
utils.errorAndExit(err);
}

var opts = !_.isEmpty(program.openWith) ? { app: program.openWith } : {};
opn(url, opts);
if (program.url) {
console.log(url);
} else {
var opts = !_.isEmpty(program.openWith) ? { app: program.openWith } : {};
opn(url, opts);

utils.log(program, logger, 'checking for updates');
utils.checkForUpdate(function(){
Developer.trackActivity(logger);
setTimeout(function(){ process.exit(0); }, 3000); // needed for if browser is still open
});
utils.log(program, logger, 'checking for updates');
utils.checkForUpdate(function(){
Developer.trackActivity(logger);
setTimeout(function(){ process.exit(0); }, 3000); // needed for if browser is still open
});
}
});
};

Expand All @@ -84,4 +89,4 @@ if(useDefaultAcct){
}
else{
execute();
}
}
6 changes: 4 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
★ Release Notes: 2019-03-29
★ Release Notes: 2019-12-19
≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

Thanks for upgrading to the latest version of the ALKS CLI!

→ Adds support for per-role max session durations coming soon to ALKS
→ Updates the ALKS refresh token URL (developer login2fa)
→ Adds support for exporting the AWS Console URL (session console -u)
→ Fixes a bug with netrc on Linux

→ Have feedback? https://github.com/Cox-Automotive/ALKS-CLI/issues

Expand Down
8 changes: 4 additions & 4 deletions lib/developer.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ exports.storeToken = function(token, callback){
}
else{
netrc.update(SERVICETKN, {
token: token
password: token
});

chmod(utils.getFilePathInHome('.netrc'), utils.getOwnerRWOnlyPermission());
Expand Down Expand Up @@ -223,8 +223,8 @@ exports.getToken = function(cb){
}
else{
var auth = netrc(SERVICETKN);
if(!_.isEmpty(auth.token)){
cb(auth.token);
if(!_.isEmpty(auth.password)){
cb(auth.password);
}
else{
cb(null);
Expand Down Expand Up @@ -544,4 +544,4 @@ exports.trackActivity = function(activity){
else{
onComplete();
}
};
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alks",
"version": "3.0.3",
"version": "3.0.4",
"description": "CLI for working with ALKS",
"main": "bin/alks",
"scripts": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"chmod": "^0.2.1",
"cli-color": "^1.1.0",
"cli-table3": "^0.5.0",
"clortho": "https://github.com/Cox-Automotive/clortho/archive/1.2.3.tar.gz",
"clortho": "Cox-Automotive/clortho#1.2.3",
"commander": "^2.9.0",
"crypto": "0.0.3",
"fuzzy": "^0.1.1",
Expand Down

0 comments on commit 8f0a888

Please sign in to comment.