Skip to content

Redirect from oauth service striping headers & cookies #1368

Open
@ngigiwaithaka

Description

@ngigiwaithaka

Hi,

Is there a way to redirect the headers received from a callback originating from a OAuth Server?

I have tried basic redirection, and also using ReDirector + Extractor, but they all strip away the headers & cookies as they redirect....

I have resorted to encoding the same as query values. Is there a better and more secure way than below?

Redirector redirector = new Redirector(getContext(), "", Redirector.MODE_CLIENT_TEMPORARY) { 
			
			@Override
			public void handle(Request request, Response response) {
				final String identifier = request.getAttributes().get("identifier").toString();
				final String accessToken = request.getAttributes().get("accessToken").toString();
				
				//request.getCookies().add("identifier", identifier);
				final String redirectUri = request.getResourceRef().getQueryAsForm().getFirstValue("redirectUri");
				
				final Reference reference = new Reference(redirectUri);
				reference.addQueryParameter("identifier", identifier);
				reference.addQueryParameter("accessToken", accessToken);
				setTargetTemplate(reference.getIdentifier());

				super.handle(request, response);
			}
		};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions