use of org.springframework.security.core.authority.GrantedAuthorityImpl 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;
}
use of org.springframework.security.core.authority.GrantedAuthorityImpl in project onebusaway-application-modules by camsys.
the class StandardAuthoritiesServiceImpl method createStandardAuthority.
private GrantedAuthority createStandardAuthority(final String name) {
assert !_standardAuthoritiesMap.containsKey(name);
assert !_userRoles.containsKey(name);
UserRole role = _userDao.getUserRoleForName(name);
if (role == null) {
role = new UserRole(name);
_userDao.saveOrUpdateUserRole(role);
}
_userRoles.put(name, role);
final GrantedAuthority auth = new GrantedAuthorityImpl(name);
_standardAuthoritiesMap.put(name, auth);
return auth;
}
Aggregations