use of org.acegisecurity.GrantedAuthority in project blueocean-plugin by jenkinsci.
the class PipelineStepImpl method canSubmit.
private boolean canSubmit(InputStep inputStep) {
Authentication a = Jenkins.getAuthentication();
String submitter = inputStep.getSubmitter();
if (submitter == null || a.getName().equals(submitter)) {
return true;
}
for (GrantedAuthority ga : a.getAuthorities()) {
if (ga.getAuthority().equals(submitter)) {
return true;
}
}
return false;
}
use of org.acegisecurity.GrantedAuthority in project promoted-builds-plugin by jenkinsci.
the class ManualCondition method isInGroupList.
/*
* Check if user is a member of a groups as listed in the user / group field
*/
public boolean isInGroupList() {
Set<String> groups = getUsersAsSet();
GrantedAuthority[] authorities = Hudson.getAuthentication().getAuthorities();
for (GrantedAuthority authority : authorities) {
if (groups.contains(authority.getAuthority()))
return true;
}
return false;
}
use of org.acegisecurity.GrantedAuthority in project hudson-2.x by hudson.
the class PAMSecurityRealm method createSecurityComponents.
public SecurityComponents createSecurityComponents() {
Binding binding = new Binding();
binding.setVariable("instance", this);
BeanBuilder builder = new BeanBuilder();
builder.parse(Hudson.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/PAMSecurityRealm.groovy"), binding);
WebApplicationContext context = builder.createApplicationContext();
return new SecurityComponents(findBean(AuthenticationManager.class, context), new UserDetailsService() {
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
if (!UnixUser.exists(username))
throw new UsernameNotFoundException("No such Unix user: " + username);
// return some dummy instance
return new User(username, "", true, true, true, true, new GrantedAuthority[] { AUTHENTICATED_AUTHORITY });
}
});
}
Aggregations