Example usage for org.springframework.security.oauth2.client.resource OAuth2ProtectedResourceDetails getClientId

List of usage examples for org.springframework.security.oauth2.client.resource OAuth2ProtectedResourceDetails getClientId

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.client.resource OAuth2ProtectedResourceDetails getClientId.

Prototype

public String getClientId();

Source Link

Document

The client identifier to use for this protected resource.

Usage

From source file:org.cloudfoundry.identity.uaa.integration.TestAccountSetup.java

private boolean clientExists(RestOperations client, OAuth2ProtectedResourceDetails resource) {
    ResponseEntity<String> response = client
            .getForEntity(serverRunning.getClientsUri() + "/" + resource.getClientId(), String.class);
    return response != null && response.getStatusCode() == HttpStatus.OK;
}

From source file:org.openmhealth.shim.runkeeper.RunkeeperShim.java

@Override
protected String getAuthorizationUrl(UserRedirectRequiredException exception) {

    final OAuth2ProtectedResourceDetails resource = getResource();

    UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri())
            .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId())
            .queryParam("response_type", "code").queryParam("redirect_uri", getCallbackUrl());

    return uriBuilder.build().encode().toUriString();
}

From source file:org.openmhealth.shim.misfit.MisfitShim.java

@Override
protected String getAuthorizationUrl(UserRedirectRequiredException exception) {

    final OAuth2ProtectedResourceDetails resource = getResource();

    UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri())
            .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId())
            .queryParam("response_type", "code").queryParam("scope", Joiner.on(',').join(resource.getScope()))
            .queryParam("redirect_uri", getCallbackUrl());

    return uriBuilder.build().encode().toUriString();
}

From source file:org.openmhealth.shim.jawbone.JawboneShim.java

@Override
protected String getAuthorizationUrl(UserRedirectRequiredException exception) {

    final OAuth2ProtectedResourceDetails resource = getResource();

    UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri())
            .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId())
            .queryParam("response_type", "code")
            .queryParam("scope", StringUtils.collectionToDelimitedString(resource.getScope(), " "))
            .queryParam("redirect_uri", getCallbackUrl());

    return uriBuilder.build().encode().toUriString();

}

From source file:org.openmhealth.shim.googlefit.GoogleFitShim.java

@Override
protected String getAuthorizationUrl(UserRedirectRequiredException exception) {
    final OAuth2ProtectedResourceDetails resource = getResource();

    UriComponentsBuilder uriBuilder = UriComponentsBuilder.fromUriString(exception.getRedirectUri())
            .queryParam("state", exception.getStateKey()).queryParam("client_id", resource.getClientId())
            .queryParam("response_type", "code").queryParam("access_type", "offline")
            .queryParam("approval_prompt", "force")
            .queryParam("scope", StringUtils.collectionToDelimitedString(resource.getScope(), " "))
            .queryParam("redirect_uri", getCallbackUrl());

    return uriBuilder.build().encode().toUriString();
}

From source file:org.openmhealth.shim.ihealth.IHealthShim.java

@Override
protected String getAuthorizationUrl(UserRedirectRequiredException exception) {
    final OAuth2ProtectedResourceDetails resource = getResource();

    UriComponentsBuilder callBackUriBuilder = UriComponentsBuilder.fromUriString(getCallbackUrl())
            .queryParam("state", exception.getStateKey());

    UriComponentsBuilder authorizationUriBuilder = UriComponentsBuilder
            .fromUriString(exception.getRedirectUri()).queryParam("client_id", resource.getClientId())
            .queryParam("response_type", "code").queryParam("APIName", Joiner.on(' ').join(resource.getScope()))
            .queryParam("redirect_uri", callBackUriBuilder.build().toString());

    return authorizationUriBuilder.build().encode().toString();
}