]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3776 Provide a WS Api to validate a user's login/password
authorDavid Gageot <david@gageot.net>
Mon, 10 Sep 2012 16:22:35 +0000 (18:22 +0200)
committerDavid Gageot <david@gageot.net>
Mon, 10 Sep 2012 16:22:35 +0000 (18:22 +0200)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/authentication_controller.rb
sonar-ws-client/src/main/java/org/sonar/wsclient/services/AuthenticationQuery.java
sonar-ws-client/src/test/java/org/sonar/wsclient/services/AuthenticationQueryTest.java

index fdc47c440fdeae94e88ad92c0b977d49efe83109..9040b8e503066f626d848051b90e6b865d3c052b 100644 (file)
@@ -21,15 +21,17 @@ class Api::AuthenticationController < Api::ApiController
   skip_before_filter :check_authentication
 
   # prevent HTTP proxies from caching authentication status
-  before_filter :set_cache_buster, :only => 'index'
+  before_filter :set_cache_buster
 
   #
-  # GET /api/authentication/index
-  # curl http://localhost:9000/api/authentication/index -v -u admin:admin
+  # GET /api/authentication/validate
+  # curl http://localhost:9000/api/authentication/validate -v -u admin:admin
   #
-  def index
+  def validate
     hash={:valid => valid?}
 
+    reset_session
+
     respond_to do |format|
       format.json { render :json => jsonp(hash) }
       format.xml { render :xml => hash.to_xml(:skip_types => true, :root => 'authentication') }
index 5d4fcf4ab248699b6b85c0410acbb1ae0c8ff646..6e1975a28ec7d1a2ace93d97edcff4ac22cc9a06 100644 (file)
@@ -20,7 +20,7 @@
 package org.sonar.wsclient.services;
 
 public class AuthenticationQuery extends Query<Authentication> {
-  public static final String BASE_URL = "/api/authentication/index";
+  public static final String BASE_URL = "/api/authentication/validate";
 
   @Override
   public String getUrl() {
index cfdb766b8b98e18c25c0701e97493f2b18aae92e..d53cd9f8bbe103d3bd261bcac9e2d9cd9e15d662 100644 (file)
@@ -28,7 +28,7 @@ public class AuthenticationQueryTest extends QueryTestCase {
   public void should_query_right_url() {
     AuthenticationQuery query = new AuthenticationQuery();
 
-    assertThat(query.getUrl()).isEqualTo("/api/authentication/index");
+    assertThat(query.getUrl()).isEqualTo("/api/authentication/validate");
     assertThat(query.getModelClass().getName()).isEqualTo(Authentication.class.getName());
   }
 }