David Carr avatar David Carr committed 7cbfed4

Completely remove the need for any configuration for the Active Directory plugin.

Comments (0)

Files changed (5)

plugins/scm-activedirectory-auth-plugin/src/main/java/sonia/scm/activedirectory/auth/ActiveDirectoryAuthenticationHandler.java

 
 //~--- non-JDK imports --------------------------------------------------------
 
-import com.google.inject.Inject;
 import com.google.inject.Singleton;
 import com4j.COM4J;
 import com4j.Com4jObject;
 
 import sonia.scm.SCMContextProvider;
 import sonia.scm.plugin.ext.Extension;
-import sonia.scm.store.Store;
-import sonia.scm.store.StoreFactory;
 import sonia.scm.user.User;
 import sonia.scm.util.AssertUtil;
 import sonia.scm.util.SystemUtil;
 {
 
   /** Field description */
-  public static final String STORE_NAME = "activedirectory-auth";
-
-  /** Field description */
   public static final String TYPE = "activedirectory";
 
   /** the logger for ActiveDirectoryAuthenticationHandler */
   private static final Logger logger = LoggerFactory
       .getLogger(ActiveDirectoryAuthenticationHandler.class);
 
-  //~--- constructors ---------------------------------------------------------
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param storeFactory
-   */
-  @Inject
-  public ActiveDirectoryAuthenticationHandler(StoreFactory storeFactory)
-  {
-    store = storeFactory.getStore(ActiveDirectoryConfig.class, STORE_NAME);
-  }
-
   //~--- methods --------------------------------------------------------------
 
   /**
   public void init(SCMContextProvider context)
   {
 
-    config = store.get();
-
-    if (config == null)
-    {
-      config = new ActiveDirectoryConfig();
-    }
-
     if (!canDoNativeAuth())
     {
       if (logger.isErrorEnabled())
     }
   }
 
-  /**
-   * Method description
-   *
-   */
-  public void storeConfig()
-  {
-    store.set(config);
-  }
-
   //~--- get methods ----------------------------------------------------------
 
   /**
    *
    * @return
    */
-  public ActiveDirectoryConfig getConfig()
-  {
-    return config;
-  }
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
   @Override
   public String getType()
   {
     return TYPE;
   }
 
-  //~--- set methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param config
-   */
-  public void setConfig(ActiveDirectoryConfig config)
-  {
-    this.config = config;
-  }
-
   //~--- methods --------------------------------------------------------------
 
   /**
   //~--- fields ---------------------------------------------------------------
 
   /** Field description */
-  private ActiveDirectoryConfig config;
-
-  /** Field description */
-  private Store<ActiveDirectoryConfig> store;
-
-  /** Field description */
   private String defaultNamingContext;
 
   /** Field description */

plugins/scm-activedirectory-auth-plugin/src/main/java/sonia/scm/activedirectory/auth/ActiveDirectoryConfig.java

-/**
- * Copyright (c) 2010, Sebastian Sdorra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. Neither the name of SCM-Manager; nor the names of its
- *    contributors may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-package sonia.scm.activedirectory.auth;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-
-/**
- *
- * @author David M. Carr
- */
-@XmlRootElement(name = "activedirectory-config")
-@XmlAccessorType(XmlAccessType.FIELD)
-public class ActiveDirectoryConfig
-{}

plugins/scm-activedirectory-auth-plugin/src/main/java/sonia/scm/activedirectory/auth/ActiveDirectoryConfigResource.java

-/**
- * Copyright (c) 2010, Sebastian Sdorra
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. Neither the name of SCM-Manager; nor the names of its
- *    contributors may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * http://bitbucket.org/sdorra/scm-manager
- *
- */
-
-package sonia.scm.activedirectory.auth;
-
-//~--- non-JDK imports --------------------------------------------------------
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-//~--- JDK imports ------------------------------------------------------------
-
-import java.io.IOException;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-/**
- *
- * @author David M. Carr
- */
-@Singleton
-@Path("config/auth/activedirectory")
-public class ActiveDirectoryConfigResource
-{
-
-  /**
-   * Constructs ...
-   *
-   *
-   * @param authenticationHandler
-   */
-  @Inject
-  public ActiveDirectoryConfigResource(ActiveDirectoryAuthenticationHandler authenticationHandler)
-  {
-    this.authenticationHandler = authenticationHandler;
-  }
-
-  //~--- get methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @return
-   */
-  @GET
-  @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-  public ActiveDirectoryConfig getConfig()
-  {
-    return authenticationHandler.getConfig();
-  }
-
-  //~--- set methods ----------------------------------------------------------
-
-  /**
-   * Method description
-   *
-   *
-   * @param uriInfo
-   * @param config
-   *
-   * @return
-   *
-   * @throws IOException
-   */
-  @POST
-  @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
-  public Response setConfig(@Context UriInfo uriInfo, ActiveDirectoryConfig config)
-          throws IOException
-  {
-    authenticationHandler.setConfig(config);
-    authenticationHandler.storeConfig();
-
-    return Response.created(uriInfo.getRequestUri()).build();
-  }
-
-  //~--- fields ---------------------------------------------------------------
-
-  /** Field description */
-  private ActiveDirectoryAuthenticationHandler authenticationHandler;
-}

plugins/scm-activedirectory-auth-plugin/src/main/resources/META-INF/scm/plugin.xml

     <url>${project.url}</url>
   </information>
 
-  <resources>
-    <script>/sonia/scm/activedirectory/auth/sonia.activedirectory-auth.js</script>
-  </resources>
-
 </plugin>

plugins/scm-activedirectory-auth-plugin/src/main/resources/sonia/scm/activedirectory/auth/sonia.activedirectory-auth.js

-/* *
- * Copyright (c) 2010, Sebastian Sdorra
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- * 3. Neither the name of SCM-Manager; nor the names of its
- *    contributors may be used to endorse or promote products derived from this
- *    software without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * http://bitbucket.org/sdorra/scm-manager
- * 
- */
-
-
-registerGeneralConfigPanel({
-  xtype : 'configForm',
-  title : 'Active Directory Authentication',
-  items : [],
-
-  onSubmit: function(values){
-    this.el.mask('Submit ...');
-    Ext.Ajax.request({
-      url: restUrl + 'config/auth/activedirectory.json',
-      method: 'POST',
-      jsonData: values,
-      scope: this,
-      disableCaching: true,
-      success: function(response){
-        this.el.unmask();
-      },
-      failure: function(){
-        this.el.unmask();
-      }
-    });
-  },
-
-  onLoad: function(el){
-    var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100);
-    Ext.Ajax.request({
-      url: restUrl + 'config/auth/activedirectory.json',
-      method: 'GET',
-      scope: this,
-      disableCaching: true,
-      success: function(response){
-        var obj = Ext.decode(response.responseText);
-        this.load(obj);
-        clearTimeout(tid);
-        el.unmask();
-      },
-      failure: function(){
-        el.unmask();
-        clearTimeout(tid);
-        Ext.MessageBox.show({
-          title: 'Error',
-          msg: 'Could not load Active Directory config.',
-          buttons: Ext.MessageBox.OK,
-          icon:Ext.MessageBox.ERROR
-        });
-      }
-    });
-  }
-});
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.