activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1162615 - in /activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources: BrokerResource.scala Support.scala
Date Mon, 29 Aug 2011 00:31:31 GMT
Author: chirino
Date: Mon Aug 29 00:31:31 2011
New Revision: 1162615

URL: http://svn.apache.org/viewvc?rev=1162615&view=rev
Log:
Don't create an HTTP session unless the user is valid.

Modified:
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala?rev=1162615&r1=1162614&r2=1162615&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerResource.scala
Mon Aug 29 00:31:31 2011
@@ -77,13 +77,16 @@ case class BrokerResource() extends Reso
   @POST
   @Path("signin")
   def post_signin(@Context response:HttpServletResponse, @FormParam("username") username:String,
@FormParam("password") password:String):Boolean =  {
-    val session = http_request.getSession(true)
-    session.setAttribute("username", username);
-    session.setAttribute("password", password);
     try {
+      http_request.setAttribute("username", username)
+      http_request.setAttribute("password", password)
       unwrap_future_result[Boolean] {
         with_broker { broker =>
           monitoring(broker) {
+            // Only create the session if he is a valid user.
+            val session = http_request.getSession(true)
+            session.setAttribute("username", username)
+            session.setAttribute("password", password)
             true
           }
         }

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala?rev=1162615&r1=1162614&r2=1162615&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/Support.scala
Mon Aug 29 00:31:31 2011
@@ -165,8 +165,11 @@ abstract class Resource(parent:Resource=
       security_context.remote_address = new InetSocketAddress(http_request.getRemoteAddr,
http_request.getRemotePort)
       security_context.certificates = http_request.getAttribute("javax.servlet.request.X509Certificate").asInstanceOf[Array[X509Certificate]]
 
-      val session = http_request.getSession(false)
-      if( session !=null ) {
+      if(http_request.getAttribute("username")!=null) {
+        security_context.user = http_request.getAttribute("username").asInstanceOf[String];
+        security_context.password = http_request.getAttribute("password").asInstanceOf[String];
+      } else if( http_request.getSession(false) !=null ) {
+        val session = http_request.getSession(false)
         security_context.user = session.getAttribute("username").asInstanceOf[String];
         security_context.password = session.getAttribute("password").asInstanceOf[String];
       } else {



Mime
View raw message