You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Charles Moulliard <ch...@gmail.com> on 2016/02/10 17:52:21 UTC

Jetty + Jaas on Karaf (Jetty - Authenticated as UNAUTHENTICATED)

Hi,

My project includes an AuthenticationFilter which is called when a HTTP
request is issued to perform a Basic HTTP Authentication. To support my
realm, I have added a new Blueprint JAAS file to configure the JAAS realm
and also deployed a user properties file on Karaf

I have added a bean to the Jetty JAAS Config file as such

<Call name="addBean">
        <Arg>
            <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
                <Set name="name">apiman</Set>
                <Set name="loginModuleName">apiman</Set>
                <Set name="roleClassNames">
                    <Array type="java.lang.String">

<Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
                        </Item>
                    </Array>
                </Set>
            </New>
        </Arg>
    </Call>

But when the HttpServletRequest.login method is called, I get this error
from Jetty Request class

    public void login(String username, String password) throws
ServletException
    {
        if (_authentication instanceof Authentication.Deferred) // /-->
Generate the error

javax.servlet.ServletException: Authenticated as UNAUTHENTICATED
at org.eclipse.jetty.server.Request.login(Request.java:2113)
at
io.apiman.common.servlet.AuthenticationFilter.doBasicAuth(AuthenticationFilter.java:232)

Do I miss something within my config ?

Regards
-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: Jetty + Jaas on Karaf (Jetty - Authenticated as UNAUTHENTICATED)

Posted by Charles Moulliard <ch...@gmail.com>.
Problem solved.

On Wed, Feb 10, 2016 at 5:52 PM, Charles Moulliard <ch...@gmail.com> wrote:

> Hi,
>
> My project includes an AuthenticationFilter which is called when a HTTP
> request is issued to perform a Basic HTTP Authentication. To support my
> realm, I have added a new Blueprint JAAS file to configure the JAAS realm
> and also deployed a user properties file on Karaf
>
> I have added a bean to the Jetty JAAS Config file as such
>
> <Call name="addBean">
>         <Arg>
>             <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
>                 <Set name="name">apiman</Set>
>                 <Set name="loginModuleName">apiman</Set>
>                 <Set name="roleClassNames">
>                     <Array type="java.lang.String">
>
> <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
>                         </Item>
>                     </Array>
>                 </Set>
>             </New>
>         </Arg>
>     </Call>
>
> But when the HttpServletRequest.login method is called, I get this error
> from Jetty Request class
>
>     public void login(String username, String password) throws
> ServletException
>     {
>         if (_authentication instanceof Authentication.Deferred) // /-->
> Generate the error
>
> javax.servlet.ServletException: Authenticated as UNAUTHENTICATED
> at org.eclipse.jetty.server.Request.login(Request.java:2113)
> at
> io.apiman.common.servlet.AuthenticationFilter.doBasicAuth(AuthenticationFilter.java:232)
>
> Do I miss something within my config ?
>
> Regards
> --
> Charles Moulliard
> Apache Committer & PMC / Architect @RedHat
> Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io
>
>


-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io