summaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webapp/src/test/resources/struts-security.xml
blob: 4a5c9ec8c70245780ea084c86c6d059f85ac2112 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<?xml version="1.0" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"> 

<!-- ==================================================================
     Plexus Security Tools

     This should contain the /security namespaced action configurations.

     These configurations will likely not need changing.

     These configurations point to the overlaid jsp files.
     ==================================================================  -->

<struts>
  <!-- ==================================================================
       Security Tools for Users

       All Users should be able to access and use the actions contained
       within this package.
       ==================================================================  -->

  <package name="security" extends="struts-default" namespace="/security">
    <result-types>
      <result-type name="security-external" class="securityExternalResult" />
    </result-types>

    <interceptors>
      <interceptor name="redbackForceAdminUser" class="redbackForceAdminUserInterceptor"/>
      <interceptor name="redbackEnvCheck" class="redbackEnvironmentCheckInterceptor"/>
      <interceptor name="redbackAutoLogin" class="redbackAutoLoginInterceptor"/>
      <interceptor name="redbackPolicyEnforcement" class="redbackPolicyEnforcementInterceptor"/>
      <interceptor name="redbackSecureActions" class="redbackSecureActionInterceptor"/>

      <!--
      Stacks are order dependent and fail silently by not running the referenced stack.
      Make sure that redbackCommonStack remains above is usages.
      -->
      <interceptor-stack name="redbackCommonStack">
         <interceptor-ref name="redbackEnvCheck"/>
         <interceptor-ref name="redbackForceAdminUser"/>
         <interceptor-ref name="redbackAutoLogin"/>
         <interceptor-ref name="redbackPolicyEnforcement"/>
         <interceptor-ref name="redbackSecureActions">
           <param name="enableReferrerCheck">true</param>
         </interceptor-ref>
      </interceptor-stack>

      <interceptor-stack name="securedStack">
        <interceptor-ref name="defaultStack"/>
        <interceptor-ref name="redbackCommonStack"/>
        <interceptor-ref name="tokenSession">
          <param name="excludeMethods">*</param>  
        </interceptor-ref>
      </interceptor-stack>
      
      <interceptor-stack name="securedPrepareParamsStack">
        <interceptor-ref name="paramsPrepareParamsStack"/>
        <interceptor-ref name="redbackCommonStack"/>
      </interceptor-stack>

    </interceptors>

    <default-interceptor-ref name="securedStack"/>

    <global-results>
      <result name="security-admin-user-needed" type="redirectAction">
        <param name="actionName">addadmin</param>
        <param name="namespace">/security</param>
      </result>
      <result name="requires-authentication">/WEB-INF/jsp/redback/requiresAuthentication.jsp</result>
      <result name="requires-authorization">/WEB-INF/jsp/redback/accessDenied.jsp</result>
      <result name="security-must-change-password" type="redirectAction">
        <param name="actionName">password</param>
        <param name="namespace">/security</param>        
      </result>
      <result name="security-resend-validation-email" type="redirectAction">
        <param name="actionName">userlist</param>
        <param name="namespace">/security</param>        
      </result>
      <result name="invalid.token">/WEB-INF/jsp/redback/invalidToken.jsp</result>
    </global-results>

    <action name="login" class="redback-login" method="show">
      <result name="input">/WEB-INF/jsp/redback/login.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/login.jsp</result>
      <result name="security-login-success" type="security-external">
        <param name="externalResult">security-login-success</param>
      </result>
      <result name="cancel" type="security-external">
        <param name="externalResult">security-login-cancel</param>
      </result>
      <result name="security-login-locked" type="security-external">
        <param name="externalResult">security-login-locked</param>
      </result>
    </action>

    <action name="logout" class="redback-logout" method="logout">
      <result name="security-logout" type="security-external">
        <param name="externalResult">security-logout</param>
      </result>
    </action>

    <action name="register" class="redback-register" method="show">
      <result name="input">/WEB-INF/jsp/redback/register.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/register.jsp</result>
      <result name="validation-note">/WEB-INF/jsp/redback/validationNotification.jsp</result>
      <result name="security-register-success" type="security-external">
        <param name="externalResult">security-register-success</param>
      </result>
      <result name="cancel" type="security-external">
        <param name="externalResult">security-register-cancel</param>
      </result>
    </action>

    <action name="account" class="redback-account" method="show">
      <result name="input">/WEB-INF/jsp/redback/account.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/account.jsp</result>
      <result name="security-account-success" type="security-external">
        <param name="externalResult">security-account-success</param>
      </result>
      <result name="cancel" type="security-external">
        <param name="externalResult">security-account-cancel</param>
      </result>
    </action>

    <action name="password" class="redback-password" method="show">
      <result name="input">/WEB-INF/jsp/redback/password.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/password.jsp</result>
      <result name="security-login-success" type="security-external">
        <param name="externalResult">security-login-success</param>
      </result>
      <result name="security-register-success" type="security-external">
        <param name="externalResult">security-register-success</param>
      </result>      
      <result name="success" type="redirect">${targetUrl}</result>
      <result name="cancel" type="redirectAction">
        <param name="actionName">logout</param>
        <param name="namespace">/security</param>
      </result>
      <result name="security-change-password-success">/WEB-INF/jsp/redback/changePasswordSuccess.jsp</result>
    </action>

    <action name="passwordReset" class="redback-password-reset" method="show">
      <result name="input">/WEB-INF/jsp/redback/requestPasswordReset.jsp</result>
      <result name="none">/WEB-INF/jsp/redback/login.jsp</result>
    </action>

    <action name="addadmin" class="redback-admin-account" method="show">
      <interceptor-ref name="defaultStack"/>
      <result name="input">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/createAdmin.jsp</result>
      <result name="login-error">/WEB-INF/jsp/redback/login.jsp</result>
      <result name="security-login-success" type="security-external">
        <param name="externalResult">security-login-success</param>
      </result>
      <result name="security-login-locked" type="security-external">
        <param name="externalResult">security-login-locked</param>
      </result>
    </action>

  <!-- ==================================================================
       Security Tools for Administrators

       Only Administrators should be able to access and use these actions
       ==================================================================  -->

    <action name="systeminfo" class="redback-sysinfo" method="show">
      <result>/WEB-INF/jsp/redback/admin/systemInformation.jsp</result>
    </action>

    <action name="adminConsole" class="redback-admin-console" method="show">
      <result>/WEB-INF/jsp/redback/admin/console.jsp</result>
    </action>

    <action name="report" class="redback-report" method="generate">
      <result name="error" type="redirectAction">userlist</result>
    </action>

    <action name="userlist" class="redback-admin-user-list" method="show">
      <result name="input">/WEB-INF/jsp/redback/admin/userList.jsp</result>
      <result name="success">/WEB-INF/jsp/redback/admin/userList.jsp</result>
    </action>

    <action name="useredit" class="redback-admin-user-edit" method="edit">
      <result name="input">/WEB-INF/jsp/redback/admin/userEdit.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/userEdit.jsp</result>
      <result name="confirm">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result>
      <result name="confirmError">/WEB-INF/jsp/redback/admin/confirmUserAdministrator.jsp</result>
      <result name="success" type="redirectAction">userlist</result>
      <result name="cancel" type="redirectAction">userlist</result>
    </action>

    <action name="usercreate" class="redback-admin-user-create" method="show">
      <result name="input">/WEB-INF/jsp/redback/admin/userCreate.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/userCreate.jsp</result>
      <result name="success" type="redirectAction">
        <param name="actionName">assignments</param>
        <param name="principal">${user.username}</param>
      </result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="userdelete" class="redback-admin-user-delete" method="confirm">
      <result name="input">/WEB-INF/jsp/redback/admin/userDelete.jsp</result>
      <result name="error" type="redirectAction">userlist</result>
      <result name="success" type="redirectAction">userlist</result>
      <result name="cancel" type="redirectAction">userlist</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <!-- ==== RBAC Actions ========================================== -->

    <!-- This action is meant to be embedded within the User Edit action output jsp.
         It is injected using the <ww:action> taglib -->
    <action name="assignments" class="redback-assignments" method="show">
      <interceptor-ref name="securedStack"/>
      <result name="input">/WEB-INF/jsp/redback/admin/assignments.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/include/error.jsp</result>
      <result name="success">/WEB-INF/jsp/redback/admin/assignments.jsp</result>
    </action>

    <action name="addRolesToUser" class="redback-assignments" method="edituser">
      <result name="success" type="redirectAction">userlist</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="removeRolesFromUser" class="redback-assignments" method="edituser">
      <result name="success" type="redirectAction">userlist</result>
    </action>

    <action name="rolecreate" class="redback-role-create" method="show">
      <result name="input">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/roleCreate.jsp</result>
      <result name="success" type="redirectAction">userlist</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="role" class="redback-role-edit" method="input">
      <result name="input">/WEB-INF/jsp/redback/admin/role.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/role.jsp</result>
      <result name="success" type="redirectAction">roles</result>
    </action>

    <action name="roleedit" class="redback-role-edit" method="edit">
      <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="success" type="redirectAction">roles</result>
    </action>

    <action name="rolesave" class="redback-role-edit" method="save">
      <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="success" type="redirectAction">roles</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="roleusersadd" class="redback-role-edit" method="addUsers">
      <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="roleusersremove" class="redback-role-edit" method="removeUsers">
      <result name="input">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="error">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <result name="success">/WEB-INF/jsp/redback/admin/roleEdit.jsp</result>
      <interceptor-ref name="securedStack">
        <param name="tokenSession.includeMethods">*</param>
      </interceptor-ref>
    </action>

    <action name="roleSummary" class="redback-roles" method="list">
       <result name="list">/WEB-INF/jsp/redback/admin/roleSummary.jsp</result>
    </action>

    <action name="roles" class="redback-roles" method="list">
      <result name="list">/WEB-INF/jsp/redback/admin/roleList.jsp</result>
    </action>

    <action name="permissions" class="redback-permissions" method="list">
      <result name="list">/WEB-INF/jsp/redback/admin/permissionList.jsp</result>
    </action>

    <action name="operations" class="redback-operations" method="list">
      <result name="list">/WEB-INF/jsp/redback/admin/operationList.jsp</result>
    </action>

    <action name="resources" class="redback-resources" method="list">
      <result name="list">/WEB-INF/jsp/redback/admin/resourceList.jsp</result>
    </action>

    <action name="roleModel" class="redback-role-model" method="view">
      <result name="success">/WEB-INF/jsp/redback/admin/roleModel.jsp</result>
    </action>

    <!--
      Backup Restore actions 
     -->

    <action name="backupRestore" class="backup-restore" method="view">
      <result>/WEB-INF/jsp/redback/admin/backupRestore.jsp</result>
    </action>
       
    <action name="backup" class="backup-restore" method="backup">
      <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result>
      <result type="redirectAction">backupRestore</result>
    </action>

    <action name="restore" class="backup-restore" method="restore">
      <result name="custom_error">/WEB-INF/jsp/redback/admin/backupRestore.jsp</result>      
      <result name="success" type="redirectAction">backupRestore</result>
    </action>
    
  </package>

</struts>