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

Create Orgs/Spaces Fails When Using Client Credentials #939

Open
twoseat opened this issue Jan 17, 2019 · 2 comments
Open

Create Orgs/Spaces Fails When Using Client Credentials #939

twoseat opened this issue Jan 17, 2019 · 2 comments
Labels
bug operations triaged Initial triage of issue has been performed

Comments

@twoseat
Copy link
Contributor

twoseat commented Jan 17, 2019

Report from a customer:

"We’re trying to use client credentials auth everywhere as opposed to CF users. I hit a problem when trying to create an Org after making that change. The java client attempts to set the org manager user, by extracting the username of the currently authenticated user from the access token. Only now we’re using a client rather than a user, there is no username available…"

This issue has already been resolved in the CLI, we need to reflect their solution. Note that there are other related issues that will probably need handling separately.

@twoseat twoseat added this to the 3.16.0.RELEASE milestone Jan 17, 2019
@twoseat twoseat modified the milestones: 3.20.0.RELEASE, 3.21.0.RELEASE Jan 7, 2020
@twoseat twoseat removed this from the 3.21.0.RELEASE milestone Feb 18, 2020
spikymonkey added a commit to spring-cloud/spring-cloud-app-broker that referenced this issue Jan 19, 2021
AT setup was failing due to our use of client credentials in CFJC's
`UaaClient`, in combination with cloudfoundry/cf-java-client#939.

All AT's passing locally now with this change.
spikymonkey added a commit to spring-cloud/spring-cloud-app-broker that referenced this issue Jan 20, 2021
* Remove log noise in ATs
* Work around inability to create orgs with client credentials. Our AT
setup was failing due to our use of client credentials in CFJC's
`UaaClient`, in combination with cloudfoundry/cf-java-client#939.
spikymonkey added a commit to spring-cloud/spring-cloud-app-broker that referenced this issue Jan 21, 2021
* Remove log noise in ATs
* Work around inability to create orgs with client credentials. Our AT
setup was failing due to our use of client credentials in CFJC's
`UaaClient`, in combination with cloudfoundry/cf-java-client#939.
spikymonkey added a commit to spring-cloud/spring-cloud-app-broker that referenced this issue Jan 21, 2021
* Remove log noise in ATs
* Work around inability to create orgs with client credentials. Our AT
setup was failing due to our use of client credentials in CFJC's
`UaaClient`, in combination with cloudfoundry/cf-java-client#939.
spikymonkey added a commit to spring-cloud/spring-cloud-app-broker that referenced this issue Jan 21, 2021
* Remove log noise in ATs
* Work around inability to create orgs with client credentials. Our AT
setup was failing due to our use of client credentials in CFJC's
`UaaClient`, in combination with cloudfoundry/cf-java-client#939.

(cherry picked from commit 044c384)
@andrejb-dev
Copy link

andrejb-dev commented May 28, 2021

HI, I am experiencing again this problem. when using ClientCredentialsGrantTokenProvider for ReactorUaaClient to creato organization

    @Value("${cf.clientId}")
    private String clientId;

    @Value("${cf.clientSecret}")
    private String clientSecret;

//...

cloudFoundryOperations = DefaultCloudFoundryOperations.builder()
                    .cloudFoundryClient(useCloudFoundryClient())
                    .uaaClient(ReactorUaaClient.builder()
                            .connectionContext(DefaultConnectionContext.builder()
                                    .apiHost(apiHost)
                                    .build())
                            .tokenProvider(ClientCredentialsGrantTokenProvider.builder()
                                    .clientId(clientId)
                                    .clientSecret(clientSecret)
                                    .build())
                            .build())
                    .build();

I get this exception:

java.lang.IllegalStateException: Unable to retrieve username from token
        at org.cloudfoundry.reactor.uaa.UsernameProvider.lambda$getUsername$3(UsernameProvider.java:75) ~[cloudfoundry-client-reactor-5.1.0.RELEASE.jar:na]
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Assembly trace from producer [reactor.core.publisher.MonoFlatMap] :
        reactor.core.publisher.Mono.checkpoint(Mono.java:1879)
        org.cloudfoundry.operations.organizations.DefaultOrganizations.create(DefaultOrganizations.java:87)
Error has been observed at the following site(s):
        |_ Mono.checkpoint ? at org.cloudfoundry.operations.organizations.DefaultOrganizations.create(DefaultOrganizations.java:87)
Stack trace:
                at org.cloudfoundry.reactor.uaa.UsernameProvider.lambda$getUsername$3(UsernameProvider.java:75) ~[cloudfoundry-client-reactor-5.1.0.RELEASE.jar:na]

Is it still actual or is it fixed? Thank you. It was closed 2 years ago, then opened again, would like to know the status of it.

@dmikusa
Copy link
Contributor

dmikusa commented Jun 4, 2021

@Zavael Sorry, I do not believe that this has been resolved. I'm trying to get up-to-speed on this one as @twoseat is not on the team anymore. Given the fact this issue is open and PR #951 is not merged, I'm under the impression this is an outstanding issue. I will get this on the roadmap to be addressed.

@dmikusa dmikusa added the triaged Initial triage of issue has been performed label Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug operations triaged Initial triage of issue has been performed
Projects
None yet
Development

No branches or pull requests

3 participants