XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.3
    • 1.3
    • Server
    • None

    Description

      There should be the option of using container-based autnetication.

      Here are some ideas from an old post in the mailing list:

      Been thinking a lot about container based authentication - primarily,
      because of my interest in the CAS integration which is necessary for
      an OFBiz integration (search for OFBizCasAuthenticationHandler.java
      class for details)

      Here a few thoughts.

      in J2EE, the way to get the user is via the following code:

      java.security.Principal principal = request.getUserPrincipal();
      if(principal != null)

      { String username = principal.getName(); // usw. usf. }

      If we used the UserPwdAuthModule in UserAuth.scala as a basis, we
      could use the following code combined with the code above to get the
      user:

      user <- UserAuth.find(By(UserAuth.authKey, name),
      By(UserAuth.authType,
      moduleName)).flatMap(_.user.obj) or
      User.find(By(User.nickname, name))

      We could take use the S object in lift to get the request and then get
      the UserPrincipal. Probably with "S.request"

      The only I don't know is how to make this Container-based authmodule
      be the default that works without a UI that implicitly calls it.

      One idea is to remove the following lines from Boot.scala
      UserAuth.register(UserPwdAuthModule)
      UserAuth.register(OpenIDAuthModule)

      and replace them with
      UserAuth.register(ContaionerAuthModule)

      ---------------

      object ContainerAuthModule extends AuthModule {

      def moduleName: String = "upw"

      def performInit(): Unit = {
      LiftRules.dispatch.append {
      case Req("authentication" :: "login" :: Nil, _, PostRequest) =>
      val from = S.referer openOr "/"

      (for {
      java.security.Principal principal = S.Request.getUserPrincipal();
      if(principal != null)

      { String username = principal.getName(); user <- UserAuth.find(By(UserAuth.authKey, username), By(UserAuth.authType, moduleName)).flatMap(_.user.obj) or User.find(By(User.nickname, username)) userAuth <- UserAuth.find(By(UserAuth.user, username), By(UserAuth.authType, moduleName)) }

      Attachments

        1. ESMELdap_ads.properties
          0.8 kB
          Vladimir Ivanov
        2. server_ads.xml
          7 kB
          Vladimir Ivanov
        3. server_plain.xml
          6 kB
          Vladimir Ivanov
        4. tomcat-users.xml
          2 kB
          Vladimir Ivanov
        5. pom.xml
          16 kB
          Vladimir Ivanov
        6. web.xml
          2 kB
          Vladimir Ivanov
        7. jetty-login.properties
          0.0 kB
          Vladimir Ivanov
        8. cm_login.jsp
          0.7 kB
          Vladimir Ivanov

        Activity

          People

            Unassigned Unassigned
            rhirsch Richard Hirsch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: