...
Code Block |
---|
GET /test/ HTTP/1.1 Host: dev-api.transformcloud.net Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 Upgrade-Insecure-Requests: 1 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36 Referer: https://dev-api.transformcloud.net/auth/realms/lin/protocol/openid-connect/auth?response_type=code&scope=openid&client_id=revalidation&state=B0Lm2UsfMwGy_9sy5C62ymqxONQ&redirect_uri=https%3A%2F%2Fdev-api.transformcloud.net%2Ftest%2Ftest&nonce=iFCESi2NDbvM2xcBQJ7jrLLbxP5szHCZa7k5rwQwwfY Accept-Encoding: gzip, deflate, sdch Accept-Language: en-US,en;q=0.8 Cookie: session=592cebb9-85db-48ae-9483-b065f86649ec OIDC_CLAIM_family_name: Hudson OIDC_CLAIM_sub: b1702d1c-c8bb-4882-99f7-2c7760681b05 OIDC_CLAIM_roles: [view-profile, manage-account, judges, admin, uma_authorization, offline_access] OIDC_CLAIM_name: James Hudson OIDC_CLAIM_groups: East of England OIDC_CLAIM_given_name: James OIDC_CLAIM_preferred_username: jamesh OIDC_CLAIM_nbf: 0 OIDC_CLAIM_jti: 268c6c62-05f9-4d8d-b2b2-04cd353cf162 OIDC_CLAIM_session_state: 55ba70b9-2f15-4068-8f4f-4fd23564e24c OIDC_CLAIM_typ: ID OIDC_CLAIM_exp: 1476971360 OIDC_CLAIM_iss: https://dev-api.transformcloud.net/auth/realms/lin OIDC_CLAIM_iat: 1476971060 OIDC_CLAIM_aud: revalidation OIDC_CLAIM_auth_time: 1476971060 OIDC_CLAIM_azp: revalidation OIDC_CLAIM_nonce: iFCESi2NDbvM2xcBQJ7jrLLbxP5szHCZa7k5rwQwwfY OIDC_CLAIM_acr: 1 OIDC_access_token: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJHVFNIYkRwN0JS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XBzIjpbIkVhc3Qgb2YgRW5nbGFuZCJdLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJqYW1lc2giLCJnaXZlbl9uYW1lIjoiSmFtZXMiLCJmYW1pbHlfbmFtZSI6Ikh1ZHNvbiJ9.VxPtvyu8jlgsHumUEKEttM27jsOirn26KokGEp9MfoiOe-Z1L_IiEs-KYsdzW2J2Fwx7amgGidlvfD0uU_EuEaoU0Wrt1uuWRHMzaVztbc1ekl0vIqk7YYvz9I84ngKug8YITgTg3ZlKLOhBUrSVeT9Pz9mFTrJZhKfX7XARVsOc2HZJqgmMG5IYitZfD5uti0enuD9EfYNqnCv_6cEbc45lFNSAMjcyJWSkNN9VPEo-_NSZQrLVmOB3oNZ5vetsw5ijb6y9TQUcrDzUu6qu74_J3n2w9PrrRXVmYeYphetNZGE2LyBScJyMuYvzu6oAik2banzLc9jGiw22tGEuQQ OIDC_access_token_expires: 1476971360 X-Forwarded-Proto: https X-Forwarded-Port: 443 X-Forwarded-For: 89.16.226.104 X-Forwarded-Host: dev-api.transformcloud.net X-Forwarded-Server: dev-api.transformcloud.net Connection: Keep-Alive |
Programmatic Access
To access an API programmatically, a new Keycloak user needs to be added to the LIN realm. The username and password can then be exchanged for a JWT token to make a request to a protected service. The following script show how a JWT token can be acquired and how that token is used to make an authenticated request, in this case, our jamesh user;
...