Search in sources :

Example 1 with BaseConsumerDetails

use of org.springframework.security.oauth.provider.BaseConsumerDetails in project spring-security-oauth by spring-projects.

the class InMemoryNonceServicesTests method consumer.

private ConsumerDetails consumer(String name) {
    BaseConsumerDetails details = new BaseConsumerDetails();
    details.setConsumerKey(name);
    return details;
}
Also used : BaseConsumerDetails(org.springframework.security.oauth.provider.BaseConsumerDetails)

Example 2 with BaseConsumerDetails

use of org.springframework.security.oauth.provider.BaseConsumerDetails in project opencast by opencast.

the class OAuthSingleConsumerDetailsService method createConsumerDetails.

/**
 * Creates a spring security consumer details object, suitable to achieve two-legged OAuth.
 *
 * @param consumerKey
 *          the consumer key
 * @param consumerName
 *          the consumer name
 * @param consumerSecret
 *          the consumer secret
 * @return the consumer details
 */
private ExtraTrustConsumerDetails createConsumerDetails(String consumerKey, String consumerName, String consumerSecret) {
    SharedConsumerSecret secret = new SharedConsumerSecret(consumerSecret);
    BaseConsumerDetails bcd = new BaseConsumerDetails();
    bcd.setConsumerKey(consumerKey);
    bcd.setConsumerName(consumerName);
    bcd.setSignatureSecret(secret);
    List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();
    authorities.add(new GrantedAuthorityImpl("ROLE_OAUTH_USER"));
    bcd.setAuthorities(authorities);
    // false for 2 legged OAuth
    bcd.setRequiredToObtainAuthenticatedToken(false);
    return bcd;
}
Also used : GrantedAuthorityImpl(org.springframework.security.core.authority.GrantedAuthorityImpl) SharedConsumerSecret(org.springframework.security.oauth.common.signature.SharedConsumerSecret) GrantedAuthority(org.springframework.security.core.GrantedAuthority) ArrayList(java.util.ArrayList) BaseConsumerDetails(org.springframework.security.oauth.provider.BaseConsumerDetails)

Aggregations

BaseConsumerDetails (org.springframework.security.oauth.provider.BaseConsumerDetails)2 ArrayList (java.util.ArrayList)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1 GrantedAuthorityImpl (org.springframework.security.core.authority.GrantedAuthorityImpl)1 SharedConsumerSecret (org.springframework.security.oauth.common.signature.SharedConsumerSecret)1