use of org.acegisecurity.userdetails.UserDetails in project blueocean-plugin by jenkinsci.
the class PipelineBaseTest method login.
protected User login(String userId, String fullName, String email) throws IOException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User bob = User.get(userId);
bob.setFullName(fullName);
if (email != null) {
bob.addProperty(new Mailer.UserProperty(email));
}
UserDetails d = Jenkins.getInstance().getSecurityRealm().loadUserByUsername(bob.getId());
SecurityContextHolder.getContext().setAuthentication(new PrincipalAcegiUserToken(bob.getId(), bob.getId(), bob.getId(), d.getAuthorities(), bob.getId()));
return bob;
}
use of org.acegisecurity.userdetails.UserDetails in project blueocean-plugin by jenkinsci.
the class BaseTest method login.
protected User login(String userId, String fullName, String email) throws IOException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User bob = User.get(userId);
bob.setFullName(fullName);
bob.addProperty(new Mailer.UserProperty(email));
UserDetails d = Jenkins.getInstance().getSecurityRealm().loadUserByUsername(bob.getId());
SecurityContextHolder.getContext().setAuthentication(new PrincipalAcegiUserToken(bob.getId(), bob.getId(), bob.getId(), d.getAuthorities(), bob.getId()));
return bob;
}
use of org.acegisecurity.userdetails.UserDetails in project blueocean-plugin by jenkinsci.
the class ProfileApiTest method testPermissionOfOtherUser.
@Test
public void testPermissionOfOtherUser() throws IOException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User alice = User.get("alice");
alice.setFullName("Alice Cooper");
alice.addProperty(new Mailer.UserProperty("alice@jenkins-ci.org"));
hudson.model.User bob = User.get("bob");
bob.setFullName("Bob Cooper");
bob.addProperty(new Mailer.UserProperty("bob@jenkins-ci.org"));
UserDetails d = Jenkins.getInstance().getSecurityRealm().loadUserByUsername(bob.getId());
SecurityContextHolder.getContext().setAuthentication(new PrincipalAcegiUserToken(bob.getId(), bob.getId(), bob.getId(), d.getAuthorities(), bob.getId()));
Assert.assertNull(new UserImpl(Iterables.getFirst(OrganizationFactory.getInstance().list(), null), alice).getPermission());
}
Aggregations