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

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

Introduction

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

Prototype

public boolean isClientOnly();

Source Link

Document

A flag to indicate that this resource is only to be used with client credentials, thus allowing access tokens to be cached independent of a user's session.

Usage

From source file:cz.cvut.zuul.support.spring.client.OAuth2ResourceDetailsBuilder.java

/**
 * @return Configured {@code OAuth2RestTemplate} instance for this resource.
 *//* w  w w . jav  a  2  s.c  o  m*/
public OAuth2RestTemplate build() {
    OAuth2ProtectedResourceDetails resource = getResourceDetails();

    OAuth2ClientContext context = resource.isClientOnly() ? new DefaultOAuth2ClientContext()
            : new ScopedOAuth2ClientContext(resource.getId());

    return new OAuth2RestTemplate(resource, context);
}