Skip to content
This repository has been archived by the owner on Dec 12, 2018. It is now read-only.

Different setting when Stormpath project use Okta api #1349

Open
weidongdiao opened this issue Jul 24, 2017 · 5 comments
Open

Different setting when Stormpath project use Okta api #1349

weidongdiao opened this issue Jul 24, 2017 · 5 comments

Comments

@weidongdiao
Copy link

When my Stormpath project want to use Okta API, besides changing the version from "0.0.7-SNAPSHOT" to "2.0.0-okta", do I need to make other changes? Because after I change the version and set Okta environment variables, it has error shows like that:

Caused by: java.lang.IllegalStateException: Unable to find an API Key 'id', either from explicit configuration (for example, ApiKeyBuilder.setApiKeyId) or from fallback locations:

  1. system property stormpath.client.apiKey.id
  2. resource file path or URL specified by system property stormpath.client.apiKey.file
  3. resource file path or URL specified by environment variable STORMPATH_API_KEY_FILE
  4. environment variable STORMPATH_API_KEY_ID
  5. default apiKey.properties file location /Users/weidongdiao/.stormpath/apiKey.properties.

Here's my pom.xml file:
com.xxx
xxxx
2.0.0-okta
jar

So how can I solve this problem?

@mraible
Copy link
Contributor

mraible commented Jul 24, 2017

Please see our Getting Started with Okta guide on how to make your app work with Okta.

This tutorial on our developer blog also shows how to make it work.

@trautvetter
Copy link

Getting Started with Okta doesn't work anymore for Spring Boot if you follow it to the letter. The Okta UI has changed for one thing, more importantly - see issue #1346.

@weidongdiao
Copy link
Author

After following the tutorial, I make some change in my pom.xml file. I update the version of com.stormpath.spring showed as followed:

com.stormpath.spring
stormpath-default-spring-boot-starter
2.0.0-okta

Then it has errors that happened in my Roles file, the error is "Exception: A granted authority textual representation is required".

Here's my code in the Roles file:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Component;

@component
public class Roles {
public final GrantedAuthority ROLE_ADMIN;

@Autowired
public Roles(Environment env) {
    ROLE_ADMIN = new SimpleGrantedAuthority(env.getProperty("stormpath.authorized.group.admin"));
}

}

I really have no idea how to solve it.

@mraible
Copy link
Contributor

mraible commented Aug 15, 2017

@weidongdiao Were you able to solve this issue?

@weidongdiao
Copy link
Author

Hi, Matt,

Because in Okta API, it just needs three environment variables: stormpath_base_url, okta_api_token and okta_application_id. So I just change "stormpath.authorized.group.admin" to "okta_application_id". So this problem has solved. However, it comes another problem, showed that "Caused by java.lang.UnsupportedOperationException: newIdSiteUrlBuilder() method hasn't been implemented."

I have no idea how to solve that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants