How to add response header to wso2 authentication endpoints

135 Views Asked by At

i'm able to add the response header to all my API except for the wso2 authentication endpoints

https://testorsampletdomain.com/oauth2/authorize

https://testorsampletdomain.com/authenticationendpoint/login.do?

https://testorsampletdomain.com/logincontext?

I need to add strict-transport-security and content-security-policy to response header of authentication endpoints pls help to address the above.

2

There are 2 best solutions below

0
Anuradha Karunarathna On BEST ANSWER

You can configure the custom header filter in the identity server by following the guide here https://github.com/wso2-extensions/identity-carbon-auth-rest#custom-header-filter NOTE: This filter is available after IS-5.11.0 https://github.com/wso2/product-is/issues/9088

When comes to step 4 of the guide: The custom response headers that you want to add;

  • for the authentication endpoint responses should be added under the application name "authenticationendpoint"

  • for the oauth2 endpoint responses should be added under the application name "oauth2"

2
Lakshitha On

How about exposing these endpoints via APIM as APIs? This way you can add a mediation policy to add these headers?