okta / okta-cli

Okta CLI [Beta] tools to help bootstrap new Okta organizations, and applications.
Apache License 2.0
89 stars 26 forks source link

`apps create` check if project matches expected type before continuing #59

Open KostiantynDrozd-okta opened 3 years ago

KostiantynDrozd-okta commented 3 years ago

Running apps create in an empty directory and creating a Spring Boot application will create a src/main/resources/application.properties while this IS expected. If there is no pom.xml, build.gradle, build.gradle.kts, in that directory it seems odd.

Steps to reproduce:

I created a new Okta account via okta-cli. Then I run command okta apps create:

okta apps create
Application name [Downloads]: test-app
Type of Application
(The Okta CLI only supports a subset of application types and properties):
> 1: Web
> 2: Single Page App
> 3: Native App (mobile)
> 4: Service (Machine-to-Machine)
Enter your choice [Web]: 1
Type of Application
> 1: Okta Spring Boot Starter
> 2: Spring Boot
> 3: JHipster
> 4: Other
Enter your choice [Other]: 1
Redirect URI
Common defaults:
 Spring Security - http://localhost:8080/login/oauth2/code/okta
 JHipster - http://localhost:8080/login/oauth2/code/oidc
Enter your Redirect URI [http://localhost:8080/login/oauth2/code/okta]: 
Enter your Post Logout Redirect URI [http://localhost:8080/]: 
Configuring a new OIDC Application, almost done:
Created OIDC application, client-id: 0oanrcmrnULlncLNc5d5

Okta application configuration has been written to: /home/kostya/Downloads/src/main/resources/application.properties

Then I found a new application in Developer console, but also in my current directory 'src' folder was created. Do we need extra description in readme, how okta apps create should work?

bdemers commented 3 years ago

src/main/resources/application.[properties|yml] is the default configuration file for Spring Boot. When you select the "Spring Boot" option that file will either be created or updated and include the application configuration.

KostiantynDrozd-okta commented 3 years ago

But is it OK, if my current directory was not sprint-boot project? My current directory Downloads folder, and after I run okta apps create then src folder was created in Downloads folder. Don't we need some check, if current folder spring app or not?

bdemers commented 3 years ago

I see what you are saying now, I tweaked the description of the issue.

To add to my previous edits, we might want to just prompt the user with an

The Okta CLI did not detect a Spring Boot project in this directory, are you sure you want to continue? [Y/n]

Or maybe instead of creating the files, we just dump the properties to the screen