Skip to content

Commit

Permalink
🎨 Release 2.0 cleanup (oktadev#280)
Browse files Browse the repository at this point in the history
- Breaking: clear credentials from AWS credentials file on logout

 - Breaking: make awscli use default (not generated) profile name

 - Breaking: remove config.properties from source

 - Breaking: remove log4j and its configuration

 - Clean up MFA handling code (rat nest -> mouse nest)

 - Allow fast reuse of existing, unexpired named sessions

 - Allow okta-aws {profilename} logout on macOS/Linux/*nix-likes

 - Address most SonarLint findings

 - Update third party notices (IANAL)

 - Update copyright to 2019

 - Apply Apache 2.0 header to most files

 - Update dependencies to latest stable versions
  • Loading branch information
AlainODea committed Mar 21, 2019
1 parent 7e1ad72 commit 21e55af
Show file tree
Hide file tree
Showing 76 changed files with 1,510 additions and 1,152 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2017 Okta
# Copyright 2019 Okta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,7 +28,6 @@ out/config.properties

.idea/workspace.xml

target/classes/log4j2.xml
/target/
.classpath
.settings
Expand All @@ -40,4 +39,3 @@ move.bat
.factorypath
.vscode

out/oktaawscli.jar
2 changes: 1 addition & 1 deletion MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.okta.tools.awscli
Main-Class: com.okta.tools.WithOkta

16 changes: 4 additions & 12 deletions Readme.MD
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ This tool has been verified to work on macOS Sierra, High Sierra, Windows Server

### Docker

1. Copy `config.properties` to `~/.okta/config.properties` and set **OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example,
1. Create `~/.okta/config.properties` and set **OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example,

```properties
OKTA_ORG=acmecorp.oktapreview.com
Expand All @@ -77,7 +77,7 @@ Create a `.okta` directory in your home directory. For example, `~/.okta`.
Download the latest release JAR and put it in `.okta`:
https://github.com/oktadeveloper/okta-aws-cli-assume-role/releases

Copy `config.properties` to `~/.okta/config.properties` and set
Create `~/.okta/config.properties` and set
**OKTA_ORG** and **OKTA_AWS_APP_URL** appropriately. For example,

```properties
Expand Down Expand Up @@ -132,17 +132,9 @@ Use ```git clone https://github.com/oktadeveloper/okta-aws-cli-assume-role.git``

```bash
mvn package
cp target/okta-aws-cli-*.jar out/oktaawscli.jar
cp target/okta-aws-cli-*.jar ~/.okta/okta-aws-cli.jar
```

### Opening the project with IntelliJ Idea

- Open the IntelliJ Idea IDE and browse to the ```okta-aws-cli-assume-role``` folder you have cloned from GitHub inside the ```Projects``` folder.
- Go to ```File => Project Structure``` and in the Libraries menu, fix the Java references that don't match your local setup.
- Go to ```Build => Make Project``` in order to compile the project.
- The project also builds the JAR artifact, so if you browse to the ```out``` sub-folder, you will see the ```oktaawscli.jar``` JAR artifact.
- Make sure the ```awscli.command``` file is in the ```out``` sub-folder.

## Configuring AWS in Okta

[Integrating the Amazon Web Services Command Line Interface Using Okta](https://support.okta.com/help/Documentation/Knowledge_Article/Integrating-the-Amazon-Web-Services-Command-Line-Interface-Using-Okta).
Expand All @@ -168,7 +160,7 @@ Here is the list of parameters that can be environment variables or settings in
- Select the ```Applications``` tab and click on your AWS Application
- Under the ```General``` menu, scroll down to find the ```App Embed Link``` section
- Your link is located under ```EMBED LINK```
- Replace the example values in ```config.properties``` with your values
- Replace the example values in ```~/.okta/config.properties``` with your values
Note: environment variables take precedence over the config file.
Expand Down
451 changes: 415 additions & 36 deletions THIRD_PARTY_NOTICES

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions awscli.bat

This file was deleted.

5 changes: 3 additions & 2 deletions bin/Install-OktaAwsCli.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright 2018 Okta
# Copyright 2019 Okta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,7 +92,7 @@ function Invoke-Java {
}
function Invoke-Okta {
Param([string]$Profile)
Param([string]$Profile = "default")
$args[0] = (Get-Command $args[0]).Name
$OriginalOKTA_PROFILE = $env:OKTA_PROFILE
try {
Expand All @@ -115,6 +115,7 @@ function Invoke-OktaAws {
Invoke-Okta -Profile $Profile aws --profile $Profile @args
}
New-Alias -Name okta-aws -value Invoke-OktaAws
New-Alias -Name awscli -value Invoke-OktaAws
function Invoke-OktaSls {
Param([string]$Profile)
Expand Down
17 changes: 0 additions & 17 deletions bin/awscli

This file was deleted.

16 changes: 0 additions & 16 deletions bin/awscli.bat

This file was deleted.

13 changes: 9 additions & 4 deletions bin/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright 2018 Okta
# Copyright 2019 Okta
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,6 +100,9 @@ if ! grep '^#OktaAWSCLI' "${bash_functions}" &>/dev/null; then
function okta-aws {
withokta "aws --profile $1" $@
}
function okta-aws {
withokta "aws --profile $1" $@
}
function okta-sls {
withokta "sls --stage $1" $@
}
Expand Down Expand Up @@ -136,6 +139,10 @@ command="$1"
profile=$2
shift;
shift;
if [ "$3" == "logout" ]
then
command="logout"
fi
env OKTA_PROFILE=$profile java \
-Djava.util.logging.config.file=~/.okta/logging.properties \
-classpath ~/.okta/okta-aws-cli.jar \
Expand Down Expand Up @@ -163,9 +170,7 @@ chmod +x "${PREFIX}/bin/okta-listroles"
# awscli
cat <<'EOF' >"${PREFIX}/bin/awscli"
#!/bin/bash
java -Djava.util.logging.config.file=~/.okta/logging.properties \
-classpath ~/.okta/okta-aws-cli.jar \
com.okta.tools.awscli $@
withokta aws default $@
EOF
chmod +x "${PREFIX}/bin/awscli"

Expand Down
17 changes: 0 additions & 17 deletions bin/okta-listroles

This file was deleted.

17 changes: 0 additions & 17 deletions bin/withokta

This file was deleted.

16 changes: 0 additions & 16 deletions bin/withokta.bat

This file was deleted.

22 changes: 0 additions & 22 deletions config.properties

This file was deleted.

17 changes: 0 additions & 17 deletions out/awscli

This file was deleted.

16 changes: 0 additions & 16 deletions out/awscli.bat

This file was deleted.

28 changes: 0 additions & 28 deletions out/log4j2.xml

This file was deleted.

17 changes: 0 additions & 17 deletions out/withokta

This file was deleted.

16 changes: 0 additions & 16 deletions out/withokta.bat

This file was deleted.

Loading

0 comments on commit 21e55af

Please sign in to comment.