org.springframework.security.oauth2.client.test
Annotation Type OAuth2ContextConfiguration


@Retention(value=RUNTIME)
@Target(value={TYPE,METHOD})
public @interface OAuth2ContextConfiguration

Annotation to signal that an OAuth2 authentication should be created and and provided to the enclosing scope (method or class). Used at the class level it will apply to all test methods (and BeforeOAuth2Context initializers). Used at the method level it will apply only to the method, overriding any value found on the enclosing class.

Author:
Dave Syer

Optional Element Summary
 boolean initialize
          Flag to indicate whether the access token should be initialized before the test method.
 Class<? extends OAuth2ProtectedResourceDetails> resource
          The resource type to use when obtaining an access token.
 Class<? extends OAuth2ProtectedResourceDetails> value
          The resource type to use when obtaining an access token.
 

value

public abstract Class<? extends OAuth2ProtectedResourceDetails> value
The resource type to use when obtaining an access token. The value provided must be a concrete implementation of OAuth2ProtectedResourceDetails. An instance will be constructed by the test framework and used to set up an OAuth2 authentication context. The strategy used for instantiating the value provided might vary depending on the consumer. Defaults to the value of resource() if not provided.

Returns:
the resource type to use
See Also:
OAuth2ContextConfiguration.Password, OAuth2ContextConfiguration.Implicit, OAuth2ContextConfiguration.ClientCredentials
Default:
org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails.class

resource

public abstract Class<? extends OAuth2ProtectedResourceDetails> resource
The resource type to use when obtaining an access token. Defaults to OAuth2ContextConfiguration.Password. Intended to be used as an alias for value().

Returns:
the resource type to use
Default:
org.springframework.security.oauth2.client.test.OAuth2ContextConfiguration.Password.class

initialize

public abstract boolean initialize
Flag to indicate whether the access token should be initialized before the test method. If false then the test method should access the protected resource or explicitly grab the access token before trying to use it. Default is true, so test methods can just grab the access token if they need it.

Returns:
flag to indicate whether the access token should be initialized before the test method
Default:
true


Copyright © 2012. All Rights Reserved.