Jetty 9 removes URI Fragments

182 Views Asked by At

I have a WebApplication that I want to secure with the security-constraint in the web.xml.

Here the loginConfig from the web.xml

<login-config>
    <auth-method>FORM</auth-method>
    <realm-name>MyUserRealm</realm-name>
    <form-login-config>
        <form-login-page>/login/login.html</form-login-page>
        <form-error-page>/login/login-error.html</form-error-page>
    </form-login-config>
</login-config>

And here the security constraints:

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Public</web-resource-name>
        <url-pattern>/login/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>Private</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>**</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
</security-constraint>

This works fine and I get redirected to the required login.html site where I can authenticate myself properly. login.html looks like this:

<form method="post" action="/j_security_check" id="loginform">
    <input class="login" value="" name="j_username" maxlength="25" type="text" placeholder="Username" required/>
    <input class="login" value="" name="j_password" maxlength="25" type="password" placeholder="Password" required/>
    <input name="submit" type="submit" value="Login" />
</form>

My Problem now is, that the URI Fragments I used for the original URL are forwarded to the login site, but after the authentication not included back to the original site. Because of that I lose all my Fragments and Parameters I want to check in the WebApp.

Anyone an idea why the URI-Fragments are removed?

1

There are 1 best solutions below

0
On

URI Fragments are not sent by a browser to a server.

See past answer on the subject: https://stackoverflow.com/a/13503246/775715