Pa11y: Injection des identifiants Basic Auth dans la configuration

This commit is contained in:
wpetit 2020-08-10 16:48:05 +02:00
parent f3e5f7b9ef
commit ffe16b7927
2 changed files with 11 additions and 0 deletions

View File

@ -2,5 +2,11 @@
"chromeLaunchConfig": { "chromeLaunchConfig": {
"args": ["--disable-dev-shm-usage", "--no-sandbox", "--disable-gpu"], "args": ["--disable-dev-shm-usage", "--no-sandbox", "--disable-gpu"],
"ignoreHTTPSErrors": true "ignoreHTTPSErrors": true
},
"headers": {
{{if not (empty .PA11Y_USERNAME)}}
{{ $credentials := print .PA11Y_USERNAME ":" .PA11Y_PASSWORD }}
"Authorization": "Basic {{b64enc $credentials}}"
{{end}}
} }
} }

View File

@ -1,10 +1,15 @@
def audit(String url, Map params = [:]) { def audit(String url, Map params = [:]) {
def reporter = params.reporter ? params.reporter : 'html' def reporter = params.reporter ? params.reporter : 'html'
def username = params.username ? params.username : '';
def password = params.password ? params.password : '';
def pa11yImage = buildDockerImage() def pa11yImage = buildDockerImage()
def dockerArgs = """ def dockerArgs = """
-e PA11Y_REPORTER='${reporter}' -e PA11Y_REPORTER='${reporter}'
-e PA11Y_URL='${url}' -e PA11Y_URL='${url}'
-e PA11Y_USERNAME='${username}'
-e PA11Y_PASSWORD='${password}'
""" """
pa11yImage.inside(dockerArgs) { pa11yImage.inside(dockerArgs) {