Search in sources :

Example 11 with GlobalMatrixAuthorizationStrategy

use of hudson.security.GlobalMatrixAuthorizationStrategy in project blueocean-plugin by jenkinsci.

the class GithubServerTest method createUser.

@Before
public void createUser() throws Exception {
    HudsonPrivateSecurityRealm realm = new HudsonPrivateSecurityRealm(true);
    User writeUser = realm.createAccount("write_user", "pale_ale");
    j.jenkins.setSecurityRealm(realm);
    GlobalMatrixAuthorizationStrategy as = new GlobalMatrixAuthorizationStrategy();
    j.jenkins.setAuthorizationStrategy(as);
    as.add(Jenkins.READ, (String) Jenkins.ANONYMOUS.getPrincipal());
    {
        as.add(Item.BUILD, writeUser.getId());
        as.add(Item.CREATE, writeUser.getId());
        as.add(Item.CONFIGURE, writeUser.getId());
    }
    token = getJwtToken(j.jenkins, "write_user", "pale_ale");
    this.crumb = getCrumb(j.jenkins);
}
Also used : User(hudson.model.User) GlobalMatrixAuthorizationStrategy(hudson.security.GlobalMatrixAuthorizationStrategy) HudsonPrivateSecurityRealm(hudson.security.HudsonPrivateSecurityRealm) Before(org.junit.Before)

Aggregations

GlobalMatrixAuthorizationStrategy (hudson.security.GlobalMatrixAuthorizationStrategy)11 HudsonPrivateSecurityRealm (hudson.security.HudsonPrivateSecurityRealm)7 Test (org.junit.Test)7 Before (org.junit.Before)3 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)2 List (java.util.List)2 Map (java.util.Map)2 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)2 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)2 Issue (org.jvnet.hudson.test.Issue)2 JenkinsRule (org.jvnet.hudson.test.JenkinsRule)2 TextPage (com.gargoylesoftware.htmlunit.TextPage)1 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)1 FreeStyleProject (hudson.model.FreeStyleProject)1 Run (hudson.model.Run)1 User (hudson.model.User)1 Permission (hudson.security.Permission)1 ArtifactArchiver (hudson.tasks.ArtifactArchiver)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1