Code source wiki de Administration
Version 1.1 par superadmin le 2026/01/29 15:25
Masquer les derniers auteurs
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | (% id='HAuthService' %) |
| 2 | == {{translation key="security.authservice.admin.title"/}} | ||
| 3 | |||
| 4 | {{velocity}} | ||
| 5 | #if ($request.setauthservice && $request.authServiceId) | ||
| 6 | #if ($services.csrf.isTokenValid($request.getParameter('form_token'))) | ||
| 7 | $services.security.authService.setAuthService($request.authServiceId) | ||
| 8 | #end | ||
| 9 | #end | ||
| 10 | {{/velocity}} | ||
| 11 | |||
| 12 | {{velocity}} | ||
| 13 | #set ($authService = $services.security.authService.getAuthService()) | ||
| 14 | #set ($configuredAuthClass = $services.security.authService.getConfiguredAuthClass()) | ||
| 15 | #if ($services.security.authService.isAuthServiceComponent()) | ||
| 16 | #set ($authServiceType = 'component') | ||
| 17 | #elseif ($configuredAuthClass && ($authService.class.name == $configuredAuthClass || $authService.class.name == 'com.xpn.xwiki.user.impl.xwiki.XWikiAuthServiceImpl')) | ||
| 18 | #set ($authServiceType = 'class') | ||
| 19 | #else | ||
| 20 | #set ($authServiceType = 'other') | ||
| 21 | #end | ||
| 22 | |||
| 23 | {{box title="{{translation key=~"security.authservice.admin.currentAuthService~"/}}"}} | ||
| 24 | #set ($authService = $services.security.authService.getAuthService()) | ||
| 25 | #set ($authServiceName = $services.localization.get("security.authservice.service.${authService.id}.name")) | ||
| 26 | #if ($authServiceName) | ||
| 27 | **{{translation key="security.authservice.service.${authService.id}.name"/}}** (//$authService.class.name//) | ||
| 28 | #set ($authServiceDescription = $services.localization.get("security.authservice.service.${authService.id}.description")) | ||
| 29 | #if ($authServiceDescription) | ||
| 30 | {{translation key="security.authservice.service.${authService.id}.description"/}} | ||
| 31 | #end | ||
| 32 | #else | ||
| 33 | $authService.class.name | ||
| 34 | #end | ||
| 35 | {{/box}} | ||
| 36 | |||
| 37 | #if ($authServiceType == 'component') | ||
| 38 | #set ($authServices = $services.security.authService.getAuthServices()) | ||
| 39 | #if ($authServices.size() > 1) | ||
| 40 | {{html}} | ||
| 41 | <form action="$xwiki.relativeRequestURL" method="post"> | ||
| 42 | <input type="hidden" name="form_token" value="$!{services.csrf.getToken()}" /> | ||
| 43 | $escapetool.xml($services.localization.render("security.authservice.admin.component.label")) | ||
| 44 | <select name="authServiceId" id="authServiceId"> | ||
| 45 | #foreach ($availableAuthService in $authServices) | ||
| 46 | <option#if ($availableAuthService.id == $authService.id) selected#end value="$escapetool.xml($availableAuthService.id)" title="$escapetool.xml($services.localization.render("security.authservice.service.${availableAuthService.id}.description"))"> | ||
| 47 | $escapetool.xml($services.localization.render("security.authservice.service.${availableAuthService.id}.name")) | ||
| 48 | </option> | ||
| 49 | #end | ||
| 50 | </select> | ||
| 51 | <button class="btn btn-danger" name="setauthservice">$escapetool.xml($services.localization.render("security.authservice.admin.component.save"))</button> | ||
| 52 | </form> | ||
| 53 | {{/html}} | ||
| 54 | #else | ||
| 55 | {{info}}{{translation key="security.authservice.admin.component.noService"/}}{{/info}} | ||
| 56 | #end | ||
| 57 | #else | ||
| 58 | #if ($authServiceType == 'other') | ||
| 59 | {{warning}}{{translation key="security.authservice.admin.other.warning"/}}{{/warning}} | ||
| 60 | #elseif ($authServiceType == 'class') | ||
| 61 | {{warning}}{{translation key="security.authservice.admin.class.warning"/}}{{/warning}} | ||
| 62 | #end | ||
| 63 | #end | ||
| 64 | {{/velocity}} | ||
| 65 | |||
| 66 | (% id='HAuthenticationSecurity' %) | ||
| 67 | == {{translation key="authentication.admin.heading"/}} | ||
| 68 | |||
| 69 | {{velocity}} | ||
| 70 | #set ($discard = $xwiki.jsx.use('XWiki.Authentication.Administration')) | ||
| 71 | #set ($authConfig = $services.security.authentication.authenticationConfiguration) | ||
| 72 | #set ($selectedStrategies = {}) | ||
| 73 | #foreach ($strategy in $authConfig.getFailureStrategies()) | ||
| 74 | #set ($discard = $selectedStrategies.put($strategy, true)) | ||
| 75 | #end | ||
| 76 | {{html clean="false"}} | ||
| 77 | <form method="post" id="authenticationSecurityConfigForm" action="${xwiki.getURL('XWiki.Authentication.Configuration', 'save')}" class='xform'> | ||
| 78 | <div class="hidden"> | ||
| 79 | <input type='hidden' name='form_token' value="$!{services.csrf.getToken()}" /> | ||
| 80 | <input type='hidden' name='xredirect' value="$xwiki.getRequestURL()" /> | ||
| 81 | </div> | ||
| 82 | <dl> | ||
| 83 | <dt> | ||
| 84 | <label for="XWiki.Authentication.ConfigurationClass_0_isAuthenticationSecurityEnabled">$services.localization.render('authentication.admin.isAuthenticationSecurityEnabled.label')</label> | ||
| 85 | <span class='xHint'>$services.localization.render('authentication.admin.isAuthenticationSecurityEnabled.hint')</span> | ||
| 86 | <dt> | ||
| 87 | <dd> | ||
| 88 | <select name="XWiki.Authentication.ConfigurationClass_0_isAuthenticationSecurityEnabled" id="XWiki.Authentication.ConfigurationClass_0_isAuthenticationSecurityEnabled"> | ||
| 89 | <option value="0" #if(!$authConfig.isAuthenticationSecurityEnabled())selected="selected"#end>$services.localization.render('authentication.admin.isAuthenticationSecurityEnabled.disabled')</option> | ||
| 90 | <option value="1" #if($authConfig.isAuthenticationSecurityEnabled())selected="selected"#end>$services.localization.render('authentication.admin.isAuthenticationSecurityEnabled.enabled')</option> | ||
| 91 | </select> | ||
| 92 | </dd> | ||
| 93 | </dl> | ||
| 94 | <dl> | ||
| 95 | <dt> | ||
| 96 | <label for="XWiki.Authentication.ConfigurationClass_0_failureStrategy">$services.localization.render('authentication.admin.failureStrategy.label')</label> | ||
| 97 | <span class='xHint'>$services.localization.render('authentication.admin.failureStrategy.hint')</span> | ||
| 98 | </dt> | ||
| 99 | <dd> | ||
| 100 | <select name="XWiki.Authentication.ConfigurationClass_0_failureStrategy" id="XWiki.Authentication.ConfigurationClass_0_failureStrategy" multiple="multiple"> | ||
| 101 | #foreach ($failureStrategy in $services.security.authentication.authenticationFailureAvailableStrategies) | ||
| 102 | <option value="${failureStrategy}" #if($selectedStrategies.get($failureStrategy))selected='selected'#end> | ||
| 103 | $services.localization.render("authentication.admin.failureStrategy.${failureStrategy}.name") | ||
| 104 | </option> | ||
| 105 | #end | ||
| 106 | </select> | ||
| 107 | </dd> | ||
| 108 | <dt> | ||
| 109 | <label for="XWiki.Authentication.ConfigurationClass_0_maxAuthorizedAttempts">$services.localization.render('authentication.admin.maxAttempts.label')</label> | ||
| 110 | <span class='xHint'>$services.localization.render('authentication.admin.maxAttempts.hint')</span> | ||
| 111 | </dt> | ||
| 112 | <dd> | ||
| 113 | <input type="number" name="XWiki.Authentication.ConfigurationClass_0_maxAuthorizedAttempts" id="XWiki.Authentication.ConfigurationClass_0_maxAuthorizedAttempts" value="$authConfig.maxAuthorizedAttempts" min="0" class="form-control" /> | ||
| 114 | </dd> | ||
| 115 | <dt> | ||
| 116 | <label for="XWiki.Authentication.ConfigurationClass_0_timeWindowAttempts">$services.localization.render('authentication.admin.timeWindow.label')</label> | ||
| 117 | <span class='xHint'>$services.localization.render('authentication.admin.timeWindow.hint')</span> | ||
| 118 | </dt> | ||
| 119 | <dd> | ||
| 120 | <input type="number" name="XWiki.Authentication.ConfigurationClass_0_timeWindowAttempts" id="XWiki.Authentication.ConfigurationClass_0_timeWindowAttempts" value="$authConfig.timeWindow" min="0" class="form-control" /> | ||
| 121 | </dd> | ||
| 122 | </dl> | ||
| 123 | <div class='buttonwrapper'> | ||
| 124 | <input value="$services.localization.render('admin.save')" class='button' type='submit'> | ||
| 125 | </div> | ||
| 126 | </form> | ||
| 127 | {{/html}} | ||
| 128 | |||
| 129 | {{/velocity}} |