Closed s148719 closed 5 years ago
NB! Ikke klar for merge! Får ikke frem location header i respons i steg 2 ved kjøring fra NodeJs.
Id-token for testbruker kan hentes med følgende rekke av curl-kommandoer:
curl --request POST \ --url 'https://isso-q.adeo.no:443/isso/json/authenticate?authIndexType=service&authIndexValue=ldapservice' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/json' \ --header 'X-OpenAM-Password: ' \ --header 'X-OpenAM-Username: ' \ --data '{}'
output: tokenId
curl -X POST \ https://isso-q.adeo.no/isso/oauth2/authorize \ -L \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Cookie: nav-isso=<tokenId fra steg 1>' \ -d 'client_id=bidrag-dokument-ui-q0&response_type=code&redirect_uri=https%3A%2F%2Fbidrag-dokument-ui.nais.preprod.local%2F&decision=allow&csrf=<tokenId fra steg 1>&scope=openid' \ -i
Output (i location header): authorization code
curl --request POST \ --url https://isso-q.adeo.no:443/isso/oauth2/access_token \ --header 'Authorization: Basic <Base64.encode(testbruker:passord)>' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data 'grant_type=authorization_code&code=<kode fra steg 2>&redirect_uri=https%3A%2F%2Fbidrag-dokument-ui.nais.preprod.local%2F'
Jeg cherry-picked godsakene til en ny fil (fasit/userid-token.js) slik at koden ble litt mer leselig så da bare lukker og slukker vi denne feature. De curl kommandoene var gull verdt btw.
NB! Ikke klar for merge! Får ikke frem location header i respons i steg 2 ved kjøring fra NodeJs.
Id-token for testbruker kan hentes med følgende rekke av curl-kommandoer:
Steg 1:
curl --request POST \ --url 'https://isso-q.adeo.no:443/isso/json/authenticate?authIndexType=service&authIndexValue=ldapservice' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/json' \ --header 'X-OpenAM-Password:' \
--header 'X-OpenAM-Username: ' \
--data '{}'
output: tokenId
Steg 2:
curl -X POST \ https://isso-q.adeo.no/isso/oauth2/authorize \ -L \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -H 'Cookie: nav-isso=<tokenId fra steg 1>' \ -d 'client_id=bidrag-dokument-ui-q0&response_type=code&redirect_uri=https%3A%2F%2Fbidrag-dokument-ui.nais.preprod.local%2F&decision=allow&csrf=<tokenId fra steg 1>&scope=openid' \ -i
Output (i location header): authorization code
Steg 3:
curl --request POST \ --url https://isso-q.adeo.no:443/isso/oauth2/access_token \ --header 'Authorization: Basic <Base64.encode(testbruker:passord)>' \ --header 'Cache-Control: no-cache' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data 'grant_type=authorization_code&code=<kode fra steg 2>&redirect_uri=https%3A%2F%2Fbidrag-dokument-ui.nais.preprod.local%2F'