use of org.acegisecurity.adapters.PrincipalAcegiUserToken in project blueocean-plugin by jenkinsci.
the class PipelineBaseTest method login.
protected User login() throws IOException {
j.jenkins.setSecurityRealm(j.createDummySecurityRealm());
hudson.model.User bob = j.jenkins.getUser("bob");
bob.setFullName("Bob Smith");
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()));
return bob;
}
use of org.acegisecurity.adapters.PrincipalAcegiUserToken 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 = j.jenkins.getUser("alice");
alice.setFullName("Alice Cooper");
alice.addProperty(new Mailer.UserProperty("alice@jenkins-ci.org"));
hudson.model.User bob = j.jenkins.getUser("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(alice).getPermission());
}
Aggregations