0

Our application developed using JSF 1.1 framework. While enabling service provider based SSO, we need to post SAML request data with HTTP header while redirecting to IDP URL. How to set custom HTTP header value while redirecting to IDP URL in JSF 1.1 ?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

0

I'm not sure about JSF 1.1 considering that it's severely outdated. Consider updating to 2.0 or 2.2 at least. However, you might be able to have redirect occur through a managed bean action, and set headers just before a redirect.

ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response =  (HttpServletResponse)context.getResponse();
response.setHeader("Custom-Header", "test");
externalContext.redirect("foo.xhtml");

Source: https://richhewlett.com/2015/03/02/setting-http-headers-in-java-server-faces-jsf/ https://docs.oracle.com/cd/E17802_01/j2ee/j2ee/javaserverfaces/1.2/docs/api/ (Couldn't find 1.1 docs)

volosied
  • 151
  • 1
  • 6
  • This might prove useful too -- https://stackoverflow.com/questions/10604917/how-to-invoke-a-jsf-bean-action-from-a-link – volosied Mar 05 '21 at 20:58