smolnar82 opened a new pull request, #627:
URL: https://github.com/apache/knox/pull/627

   ## What changes were proposed in this pull request?
   
   A new REST API endpoint is added in `KNOX-AUTH-SERVICE` with 
``auth/api/v1/bearer` path.
   
   ## How was this patch tested?
   
   Implemented new uni test cases to cover this new functionality and executed 
manual testing:
   
   1. Default environment variable name:
   ```
   $ export BEARER_AUTH_TOKEN=MY_AUTH_BEARER_TOKEN
   $ bin/gateway.sh start
   $ curl -iku admin:admin-password -X GET 
https://localhost:8443/gateway/sandbox/auth/api/v1/bearer
   HTTP/1.1 200 OK
   Date: Fri, 26 Aug 2022 09:11:00 GMT
   Set-Cookie: KNOXSESSIONID=node01u0cyzk36nibi18g2binv7e1290.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Thu, 25-Aug-2022 09:11:00 GMT; SameSite=lax
   Authorization: Bearer MY_AUTH_BEARER_TOKEN
   Content-Length: 0
   ```
   
   2. Custom environment variable name:
   ```
   $ bin/gateway.sh stop
   $ export CUSTOM_AUTH_TOKEN_ENV=MY_CUSTOM_AUTH_BEARER_TOKEN
   $ bin/gateway.sh start
   updated sandbox.xml to
   
       <service>
            <role>KNOX-AUTH-SERVICE</role>
            <param>
                <name>auth.bearer.token.env</name>
                <value>CUSTOM_AUTH_TOKEN_ENV</value>
            </param>
       </service>
   
   $ curl -iku admin:admin-password -X GET 
https://localhost:8443/gateway/sandbox/auth/api/v1/bearer
   HTTP/1.1 200 OK
   Date: Fri, 26 Aug 2022 09:14:01 GMT
   Set-Cookie: KNOXSESSIONID=node0169z65o0ns1lphe6xi9b4cse80.node0; 
Path=/gateway/sandbox; Secure; HttpOnly
   Expires: Thu, 01 Jan 1970 00:00:00 GMT
   Set-Cookie: rememberMe=deleteMe; Path=/gateway/sandbox; Max-Age=0; 
Expires=Thu, 25-Aug-2022 09:14:01 GMT; SameSite=lax
   Authorization: Bearer MY_CUSTOM_AUTH_BEARER_TOKEN
   Content-Length: 0
   
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to