Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-15757] Add tests
A new test for the existing 'Remember me' functionality that verifies that
the cookie is set, and a new test showing that, even if requested by the
user, no cookie will be set, if 'Remember me' is disabled in the security
configuration.

Originally-Committed-As: 9ed2ed5fd90de8930802090cb7d0ffd0f996620c
  • Loading branch information
daniel-beck committed Nov 6, 2013
1 parent 27ee887 commit 5b0d293
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 0 deletions.
Expand Up @@ -62,6 +62,8 @@ enum DataSet {
* and any logged in user has a full access.
*/
ANONYMOUS_READONLY,

SECURED_ACEGI,
}

class RunnerImpl extends Recipe.Runner<PresetData> {
Expand Down
16 changes: 16 additions & 0 deletions test/src/main/preset-data/secured-acegi/config.xml
@@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<numExecutors>2</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity>
<authorizationStrategy class="hudson.security.FullControlOnceLoggedInAuthorizationStrategy"/>
<securityRealm class="hudson.security.HudsonPrivateSecurityRealm">
<disableSignup>true</disableSignup>
<enableCaptcha>false</enableCaptcha>
</securityRealm>
<jdks/>
<slaves/>
<quietPeriod>5</quietPeriod>
<slaveAgentPort>0</slaveAgentPort>
<secretKey>ed2e66995bec739c0ec71c260bd75be6918ff28b0f1b33d67e205297629a6264</secretKey>
</hudson>
3 changes: 3 additions & 0 deletions test/src/main/preset-data/secured-acegi/readme.txt
@@ -0,0 +1,3 @@
Anonymous users have no permissions, logged in users can do anything.

Uses Jenkins user database, because 'Remember me' functionality requires non-legacy security realm to be enabled.
29 changes: 29 additions & 0 deletions test/src/main/preset-data/secured-acegi/users/alice/config.xml
@@ -0,0 +1,29 @@
<?xml version='1.0' encoding='UTF-8'?>
<user>
<fullName>Alice</fullName>
<properties>
<jenkins.security.ApiTokenProperty>
<apiToken>0K7w+E0Bi/rJt1lombWFDYtw0/KLFHwBjJqN8tUd2QO4tzVXKCPuIq2uWlTUdeBd</apiToken>
</jenkins.security.ApiTokenProperty>
<hudson.model.MyViewsProperty>
<views>
<hudson.model.AllView>
<owner class="hudson.model.MyViewsProperty" reference="../../.."/>
<name>All</name>
<filterExecutors>false</filterExecutors>
<filterQueue>false</filterQueue>
<properties class="hudson.model.View$PropertyList"/>
</hudson.model.AllView>
</views>
</hudson.model.MyViewsProperty>
<hudson.search.UserSearchProperty>
<insensitiveSearch>false</insensitiveSearch>
</hudson.search.UserSearchProperty>
<hudson.security.HudsonPrivateSecurityRealm_-Details>
<passwordHash>#jbcrypt:$2a$10$9m4niaJ3tOglIM22Yd.LdOwuU9RcD9FpuXlqlJhQHKt5Qx2mh.2/i</passwordHash>
</hudson.security.HudsonPrivateSecurityRealm_-Details>
<hudson.tasks.Mailer_-UserProperty plugin="mailer@1.5">
<emailAddress>alice@example.org</emailAddress>
</hudson.tasks.Mailer_-UserProperty>
</properties>
</user>

0 comments on commit 5b0d293

Please sign in to comment.