Announcement Announcement Module
Collapse
No announcement yet.
Custom Login Page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Login Page

    Guten Tag,
    ich habe mit Spring Security begonnen ein Web Projekt zu sichern. Habe da von null angefangen.
    Bis zur automatischen Login-Page bin ich noch gekommen, aber jetzt scheitere ich.

    <http auto-config="true" use-expressions="true" >

    <intercept-url pattern="/login.do" access="permitAll" />
    <intercept-url pattern="/*" access="hasRole('ROLE_USER')"/>
    <form-login login-page="/login.do"/>

    </http>

    Das ist der Ausschnitt aus dem Security XML File.

    Ich bekomme aber andauernd den Fehler:

    "WARNUNG: Anonymous access to the login page doesn't appear to be enabled. This is almost certainly an error. Please check your configuration allows unauthenticated access to the configured login page."

    Die Page existiert, aber es klappt nicht.
    "permitAll" müsste doch den Zugang jedem Nutzer erlauben?

    LG

  • #2
    This is an English forum, so you are unlikely to get a response unless your question is in English.

    Comment


    • #3
      Okay, now this is really embarassing XD
      It was just like that in the java-forum.org nobody replied to my question, and somehow I assumed that this forum would also be a german one.
      However, I'm sure that a Spring forum is the better choice for me.

      My Problem:

      I've just started out with Spring Security and managed to set up the standard login page, etc...
      Now I'm stuck with implementing a custom login page.

      This is the excerpt from my security.xml

      <http auto-config="true" use-expressions="true" >

      <intercept-url pattern="/login.do" access="permitAll" />
      <intercept-url pattern="/*" access="hasRole('ROLE_USER')"/>
      <form-login login-page="/login.do"/>

      </http>



      When I run the application I always get an error like this:

      Warning: Anonymous access to the login page doesn't appear to be enabled. This is almost certainly an error. Please check your configuration allows unauthenticated access to the configured login page."

      I just don't get it. "permitAll" should provide access to anyone!?

      Comment


      • #4
        Can you log in?

        If so, then it's a bug.

        Comment


        • #5
          No, I can't even access the page.

          Comment


          • #6
            Please post the debug log output when you attempt to access the page.

            Comment


            • #7
              The browser shows:

              HTTP Status 404 -

              type Status report

              message

              descriptionThe requested resource () is not available.


              And the server log (Glassfish):

              INFO: Checking whether login URL '/login.do' is accessible with your configuration
              WARNUNG: Anonymous access to the login page doesn't appear to be enabled. This is almost certainly an error. Please check your configuration allows unauthenticated access to the configured login page. (Simulated access was rejected: java.lang.ClassCastException: java.lang.Object cannot be cast to org.springframework.security.web.FilterInvocation)
              INFO: Root WebApplicationContext: initialization completed in 2120 ms
              INFO: PWC1412: WebModule[/SpringMVC] ServletContext.log():Initializing Spring FrameworkServlet 'dispatcher'
              INFO: FrameworkServlet 'dispatcher': initialization started
              INFO: Refreshing WebApplicationContext for namespace 'dispatcher-servlet': startup date [Wed Apr 27 21:35:08 CEST 2011]; parent: Root WebApplicationContext
              INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]
              INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
              INFO: JSR-330 'javax.inject.Named' annotation found and supported for component scanning
              INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
              INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@464a149a: defining beans [org.springframework.web.servlet.mvc.support.Contro llerClassNameHandlerMapping#0,urlMapping,viewResol ver,indexController,loginController,reservationQue ryController,welcomeController,org.springframework .context.annotation.internalConfigurationAnnotatio nProcessor,org.springframework.context.annotation. internalAutowiredAnnotationProcessor,org.springfra mework.context.annotation.internalRequiredAnnotati onProcessor,org.springframework.context.annotation .internalCommonAnnotationProcessor,org.springframe work.context.annotation.internalPersistenceAnnotat ionProcessor,org.springframework.web.servlet.mvc.a nnotation.DefaultAnnotationHandlerMapping#0,org.sp ringframework.web.servlet.mvc.annotation.Annotatio nMethodHandlerAdapter#0]; parent: org.springframework.beans.factory.support.DefaultL istableBeanFactory@4098ffc3
              INFO: Mapped URL path [/login] onto handler [com.apress.springrecipes.court.web.LoginController @2ac302a0]
              INFO: Mapped URL path [/login/*] onto handler [com.apress.springrecipes.court.web.LoginController @2ac302a0]
              INFO: Mapped URL path [/reservationquery] onto handler [com.apress.springrecipes.court.web.ReservationQuer yController@11b33fce]
              INFO: Mapped URL path [/reservationquery/*] onto handler [com.apress.springrecipes.court.web.ReservationQuer yController@11b33fce]
              INFO: Mapped URL path [/welcome] onto handler [com.apress.springrecipes.court.web.WelcomeControll er@7ebbc4bc]
              INFO: Mapped URL path [/welcome/*] onto handler [com.apress.springrecipes.court.web.WelcomeControll er@7ebbc4bc]
              INFO: Mapped URL path [/index.htm] onto handler [org.springframework.web.servlet.mvc.Parameterizabl eViewController@707d458e]
              INFO: Mapped URL path [/login] onto handler [com.apress.springrecipes.court.web.LoginController @2ac302a0]
              INFO: Mapped URL path [/login.*] onto handler [com.apress.springrecipes.court.web.LoginController @2ac302a0]
              INFO: Mapped URL path [/login/] onto handler [com.apress.springrecipes.court.web.LoginController @2ac302a0]
              INFO: Mapped URL path [/reservationQuery] onto handler [com.apress.springrecipes.court.web.ReservationQuer yController@11b33fce]
              INFO: Mapped URL path [/reservationQuery.*] onto handler [com.apress.springrecipes.court.web.ReservationQuer yController@11b33fce]
              INFO: Mapped URL path [/reservationQuery/] onto handler [com.apress.springrecipes.court.web.ReservationQuer yController@11b33fce]
              INFO: Mapped URL path [/welcome] onto handler [com.apress.springrecipes.court.web.WelcomeControll er@7ebbc4bc]
              INFO: Mapped URL path [/welcome.*] onto handler [com.apress.springrecipes.court.web.WelcomeControll er@7ebbc4bc]
              INFO: Mapped URL path [/welcome/] onto handler [com.apress.springrecipes.court.web.WelcomeControll er@7ebbc4bc]
              INFO: FrameworkServlet 'dispatcher': initialization completed in 1597 ms
              INFO: Loading application SpringMVC at /SpringMVC
              INFO: Loading SpringMVC Application done is 5330 ms
              INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Felix(6056ms) startup services(38073ms) total(44129ms)
              INFO: Binding RMI port to *:8686
              INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATravers ableResolver.
              INFO: Created HTTP listener http-listener-1 on port 8080
              INFO: Grizzly Framework 1.9.18-o started in: 10ms listening on port 8080
              INFO: JMXStartupService: Started JMXConnector, JMXService URL = service:jmx:rmi://C5-15.herbsthofer.at:8686/jndi/rmi://C5-15.herbsthofer.at:8686/jmxrmi
              INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
              INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\JavaEE6\glassfish-3.0.1\glassfish\modules\autostart, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\ah\AppData\Local\Temp\fileinstall--6221454346498485863, felix.fileinstall.filter = null}
              INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\JavaEE6\glassfish-3.0.1\glassfish\domains\domain1\autodeploy\bundles , felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\ah\AppData\Local\Temp\fileinstall-5735456233755624881, felix.fileinstall.filter = null}
              INFO: Perform lazy SSL initialization for the listener 'http-listener-2'
              INFO: Created HTTP listener http-listener-2 on port 8181
              INFO: Grizzly Framework 1.9.18-o started in: 0ms listening on port 8181
              INFO: Updating configuration from org.apache.felix.fileinstall-autodeploy-bundles.cfg
              INFO: Installed C:\JavaEE6\glassfish-3.0.1\glassfish\modules\autostart\org.apache.felix .fileinstall-autodeploy-bundles.cfg
              INFO: {felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\JavaEE6\glassfish-3.0.1\glassfish\domains\domain1\autodeploy\bundles , felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\Users\ah\AppData\Local\Temp\fileinstall--5919968179788809660, felix.fileinstall.filter = null}



              Thanks in advance for your help!!!

              Comment


              • #8
                What version of Spring Security are you using? Ensure that all of the spring-security jars (including transitive spring-security jars) are on the latest version.

                Comment


                • #9
                  Okay, then I will check and update later whether it has helped or not.
                  Tanks a lot!

                  Comment


                  • #10
                    Done,
                    it was a problem concerning different mappings.

                    Comment

                    Working...
                    X