Repository: nutch
Updated Branches:
  refs/heads/2.x 6e3c34db1 -> 7d3e45f23


NUTCH-2344 Authentication support for Web GUI


Project: http://git-wip-us.apache.org/repos/asf/nutch/repo
Commit: http://git-wip-us.apache.org/repos/asf/nutch/commit/def06773
Tree: http://git-wip-us.apache.org/repos/asf/nutch/tree/def06773
Diff: http://git-wip-us.apache.org/repos/asf/nutch/diff/def06773

Branch: refs/heads/2.x
Commit: def067735c5a6dc46d867c4c89cb176a275b1967
Parents: 6e3c34d
Author: kamaci <[email protected]>
Authored: Mon Jan 9 17:35:49 2017 +0200
Committer: kamaci <[email protected]>
Committed: Mon Jan 9 17:35:49 2017 +0200

----------------------------------------------------------------------
 conf/nutch-default.xml                          | 11 +++
 ivy/ivy.xml                                     |  1 +
 .../apache/nutch/webui/NutchUiApplication.java  | 57 ++++++++++++++++
 .../nutch/webui/NutchUiApplication.properties   |  1 +
 .../nutch/webui/pages/AbstractBasePage.java     |  3 +-
 .../apache/nutch/webui/pages/LogOutPage.java    | 14 +++-
 .../nutch/webui/pages/assets/nutch-style.css    | 48 ++++++++++++++
 .../webui/pages/auth/AuthenticatedWebPage.java  | 24 +++++++
 .../webui/pages/auth/AuthorizationStrategy.java | 52 +++++++++++++++
 .../nutch/webui/pages/auth/SignInPage.html      | 29 ++++++++
 .../nutch/webui/pages/auth/SignInPage.java      | 70 ++++++++++++++++++++
 .../nutch/webui/pages/auth/SignInSession.java   | 51 ++++++++++++++
 .../org/apache/nutch/webui/pages/auth/User.java | 54 +++++++++++++++
 .../nutch/webui/pages/auth/package-info.java    | 22 ++++++
 14 files changed, 435 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/conf/nutch-default.xml
----------------------------------------------------------------------
diff --git a/conf/nutch-default.xml b/conf/nutch-default.xml
index 575ce5d..52cb920 100644
--- a/conf/nutch-default.xml
+++ b/conf/nutch-default.xml
@@ -1490,4 +1490,15 @@
   </description>
 </property>
 
+  <property>
+    <name>webgui.auth.users</name>
+    <value>admin|admin,user|user</value>
+    <description>
+      Username, password combination for Web GUI  authentication.
+      Username and password should be delimited by pipe character (|)
+      Every user should be separated with comma character (,). i.e. 
admin|admin,user|user.
+      Default is admin|admin,user|user
+    </description>
+  </property>
+
 </configuration>

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/ivy/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy/ivy.xml b/ivy/ivy.xml
index e173e71..9f43252 100644
--- a/ivy/ivy.xml
+++ b/ivy/ivy.xml
@@ -155,6 +155,7 @@
        
     <dependency org="org.apache.wicket" name="wicket-core" rev="6.16.0" 
conf="*->default" />
     <dependency org="org.apache.wicket" name="wicket-spring" rev="6.16.0" 
conf="*->default" />
+    <dependency org="org.apache.wicket" name="wicket-auth-roles" rev="6.16.0" 
conf="*->default" />
     <dependency org="de.agilecoders.wicket" name="wicket-bootstrap-core" 
rev="0.9.2" conf="*->default" />
     <dependency org="de.agilecoders.wicket" name="wicket-bootstrap-extensions" 
rev="0.9.2" conf="*->default" />
 

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/NutchUiApplication.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/NutchUiApplication.java 
b/src/java/org/apache/nutch/webui/NutchUiApplication.java
index 6fd2396..49bee56 100644
--- a/src/java/org/apache/nutch/webui/NutchUiApplication.java
+++ b/src/java/org/apache/nutch/webui/NutchUiApplication.java
@@ -16,11 +16,22 @@
  */
 package org.apache.nutch.webui;
 
+import org.apache.nutch.api.ConfManager;
+import org.apache.nutch.api.impl.RAMConfManager;
+import org.apache.nutch.api.resources.ConfigResource;
 import org.apache.nutch.webui.pages.DashboardPage;
 import org.apache.nutch.webui.pages.assets.NutchUiCssReference;
+import org.apache.nutch.webui.pages.auth.AuthorizationStrategy;
+import org.apache.nutch.webui.pages.auth.SignInSession;
+import org.apache.nutch.webui.pages.auth.User;
+import org.apache.wicket.Session;
 import org.apache.wicket.markup.html.WebPage;
 import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.request.Request;
+import org.apache.wicket.request.Response;
 import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -33,12 +44,20 @@ import 
de.agilecoders.wicket.core.settings.SingleThemeProvider;
 import de.agilecoders.wicket.core.settings.Theme;
 import 
de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeCssReference;
 
+import java.util.HashMap;
+import java.util.Map;
+
 @Component
 public class NutchUiApplication extends WebApplication implements
     ApplicationContextAware {
   private static final String THEME_NAME = "bootstrap";
   private ApplicationContext context;
 
+  private Map<String, User> userMap = new HashMap<>();
+  private ConfManager configManager = new RAMConfManager();
+
+  private static final Logger LOG = 
LoggerFactory.getLogger(NutchUiApplication.class);
+
   /**
    * @see org.apache.wicket.Application#getHomePage()
    */
@@ -53,6 +72,9 @@ public class NutchUiApplication extends WebApplication 
implements
   @Override
   public void init() {
     super.init();
+    initUsers();
+    getSecuritySettings().setAuthorizationStrategy(new 
AuthorizationStrategy());
+
     BootstrapSettings settings = new BootstrapSettings();
     Bootstrap.install(this, settings);
     configureTheme(settings);
@@ -72,4 +94,39 @@ public class NutchUiApplication extends WebApplication 
implements
       throws BeansException {
     this.context = applicationContext;
   }
+
+  @Override
+  public Session newSession(Request request, Response response) {
+    super.newSession(request, response);
+    return new SignInSession(request);
+  }
+
+  private void initUsers() {
+    String[] users = 
configManager.get(ConfigResource.DEFAULT).getTrimmedStrings("webgui.auth.users",
 "admin|admin,user|user");
+
+    for (String userDetailStr : users) {
+      String[] userDetail = userDetailStr.split("\\|");
+      if(userDetail.length != 2) {
+        LOG.error("Check user definition of webgui.auth.users at 
nutch-site.xml");
+        throw new IllegalStateException("Check user definition of 
webgui.auth.users at nutch-site.xml ");
+      }
+
+      User user = new User(userDetail[0], userDetail[1]);
+      userMap.put(userDetail[0], user);
+      LOG.info("User added: {}", userDetail[0]);
+    }
+  }
+
+  public User getUser(String username, String password) {
+    if (!userMap.containsKey(username)) {
+      return null;
+    }
+
+    User user = userMap.get(username);
+    if (!user.getPassword().equals(password)) {
+      return null;
+    }
+
+    return user;
+  }
 }

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/NutchUiApplication.properties
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/NutchUiApplication.properties 
b/src/java/org/apache/nutch/webui/NutchUiApplication.properties
index 4c62939..1a6859a 100644
--- a/src/java/org/apache/nutch/webui/NutchUiApplication.properties
+++ b/src/java/org/apache/nutch/webui/NutchUiApplication.properties
@@ -14,6 +14,7 @@
 #See the License for the specific language governing permissions and
 #limitations under the License.
 #############################################################################
+title.signinpage = Nutch Login Page
 
 navbar.menu.dashboard = Dashboard
 navbar.menu.statistics = Statistics

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java 
b/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
index 22b851c..b3f9767 100644
--- a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
+++ b/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
@@ -22,6 +22,7 @@ import static 
de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarComp
 import java.util.List;
 
 import org.apache.nutch.webui.model.NutchInstance;
+import org.apache.nutch.webui.pages.auth.AuthenticatedWebPage;
 import org.apache.nutch.webui.pages.crawls.CrawlsPage;
 import org.apache.nutch.webui.pages.instances.InstancesPage;
 import org.apache.nutch.webui.pages.menu.VerticalMenu;
@@ -56,7 +57,7 @@ import 
de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarComponents;
 import 
de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton;
 import 
de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeIconType;
 
-public abstract class AbstractBasePage<T> extends GenericWebPage<T> {
+public abstract class AbstractBasePage<T> extends GenericWebPage<T> implements 
AuthenticatedWebPage {
   @SpringBean
   private NutchService service;
 

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/LogOutPage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/LogOutPage.java 
b/src/java/org/apache/nutch/webui/pages/LogOutPage.java
index 9d0298f..2af7253 100644
--- a/src/java/org/apache/nutch/webui/pages/LogOutPage.java
+++ b/src/java/org/apache/nutch/webui/pages/LogOutPage.java
@@ -16,6 +16,18 @@
  */
 package org.apache.nutch.webui.pages;
 
+import org.apache.nutch.webui.pages.auth.SignInPage;
+
+import javax.servlet.http.HttpServletRequest;
+
 public class LogOutPage extends AbstractBasePage {
 
-}
+  public LogOutPage() {
+    HttpServletRequest servletReq = (HttpServletRequest) 
getRequest().getContainerRequest();
+    // Invalidate session
+    servletReq.getSession().invalidate();
+    getSession().invalidate();
+    // Redirect to sign in page
+    setResponsePage(SignInPage.class);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css 
b/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
index 8cc01ac..2aff335 100644
--- a/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
+++ b/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
@@ -146,4 +146,52 @@ table.tablesorter thead tr th:hover {
                padding-left: 15px !important;
                padding-right: 15px !important;
        }
+}
+
+.login-page {
+       width: 360px;
+       padding: 8% 0 0;
+       margin: auto;
+}
+.login-page .form {
+       position: relative;
+       z-index: 1;
+       background: #FFFFFF;
+       max-width: 360px;
+       margin: 0 auto 100px;
+       padding: 45px;
+       text-align: center;
+       box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2), 0 5px 5px 0 rgba(0, 0, 0, 
0.24);
+}
+.login-page .form input {
+       font-family: sans-serif;
+       outline: 0;
+       background: #f2f2f2;
+       width: 100%;
+       border: 0;
+       margin: 0 0 15px;
+       padding: 15px;
+       box-sizing: border-box;
+       font-size: 14px;
+}
+.login-page .form button {
+       font-family: sans-serif;
+       text-transform: uppercase;
+       outline: 0;
+       background: #4CAF50;
+       width: 100%;
+       border: 0;
+       padding: 15px;
+       color: #FFFFFF;
+       font-size: 14px;
+       -webkit-transition: all 0.3 ease;
+       transition: all 0.3 ease;
+       cursor: pointer;
+}
+.login-page .feedback {
+       margin-top: 15px;
+       color: red;
+}
+.login-page .form button:hover,.form button:active,.form button:focus {
+       background: #43A047;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/AuthenticatedWebPage.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/nutch/webui/pages/auth/AuthenticatedWebPage.java 
b/src/java/org/apache/nutch/webui/pages/auth/AuthenticatedWebPage.java
new file mode 100644
index 0000000..9c29a59
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/AuthenticatedWebPage.java
@@ -0,0 +1,24 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.webui.pages.auth;
+
+/**
+ * Marker interface for secured pages.
+ */
+public interface AuthenticatedWebPage {
+
+}

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/AuthorizationStrategy.java
----------------------------------------------------------------------
diff --git 
a/src/java/org/apache/nutch/webui/pages/auth/AuthorizationStrategy.java 
b/src/java/org/apache/nutch/webui/pages/auth/AuthorizationStrategy.java
new file mode 100644
index 0000000..269b807
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/AuthorizationStrategy.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.webui.pages.auth;
+
+import org.apache.wicket.Component;
+import org.apache.wicket.RestartResponseAtInterceptPageException;
+import org.apache.wicket.Session;
+import org.apache.wicket.authorization.Action;
+import org.apache.wicket.authorization.IAuthorizationStrategy;
+
+/**
+ * Authorization strategy to check whether to allow a page or not.
+ */
+public class AuthorizationStrategy implements IAuthorizationStrategy {
+  @Override
+  public boolean isInstantiationAuthorized(Class componentClass) {
+
+    // Check if it needs authentication or not
+    if (!AuthenticatedWebPage.class.isAssignableFrom(componentClass)) {
+      return true;
+    }
+
+    // Allow if user signed in
+    if (((SignInSession) Session.get()).isSignedIn()) {
+      return true;
+    }
+
+    // Redirect to sign in page due to page requires authentication and user 
not signed in
+    throw new RestartResponseAtInterceptPageException(SignInPage.class);
+
+  }
+
+  @Override
+  public boolean isActionAuthorized(Component component, Action action) {
+    // Authorize all actions
+    return true;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/SignInPage.html
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/auth/SignInPage.html 
b/src/java/org/apache/nutch/webui/pages/auth/SignInPage.html
new file mode 100644
index 0000000..fdbfc76
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/SignInPage.html
@@ -0,0 +1,29 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+       license agreements. See the NOTICE file distributed with this work for 
additional
+       information regarding copyright ownership. The ASF licenses this file to
+       You under the Apache License, Version 2.0 (the "License"); you may not 
use
+       this file except in compliance with the License. You may obtain a copy 
of
+       the License at http://www.apache.org/licenses/LICENSE-2.0 Unless 
required
+       by applicable law or agreed to in writing, software distributed under 
the
+       License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
CONDITIONS
+       OF ANY KIND, either express or implied. See the License for the specific
+       language governing permissions and limitations under the License. -->
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org";>
+<head>
+       <title><wicket:message key="title.signinpage">Nutch Login 
Page</wicket:message></title>
+</head>
+<body>
+       <div class="login-page">
+               <div class="form">
+                       <h3>Login to Nutch</h3><br>
+                       <form wicket:id="form" class="login-form">
+                               <input id="username" wicket:id="username" 
type="text" placeholder="username" autofocus/>
+                               <input id="password" wicket:id="password" 
type="password" placeholder="password"/>
+                               <button type="submit" id="submit">LOGIN</button>
+                       </form>
+                       <span class="feedback" wicket:id="feedback"></span>
+               </div>
+       </div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/SignInPage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/auth/SignInPage.java 
b/src/java/org/apache/nutch/webui/pages/auth/SignInPage.java
new file mode 100644
index 0000000..863e69f
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/SignInPage.java
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.webui.pages.auth;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.markup.html.form.TextField;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.model.PropertyModel;
+
+/**
+ * Sign in page implementation.
+ */
+public class SignInPage extends WebPage {
+
+  private User user = new User();
+
+  public SignInPage() {
+    add(new LoginForm("form"));
+    add(new FeedbackPanel("feedback"));
+  }
+
+  private class LoginForm extends Form<Void> {
+
+    public LoginForm(String id) {
+      super(id);
+
+      add(new TextField<String>("username", new PropertyModel<String>(
+              user, "username")));
+      add(new PasswordTextField("password", new PropertyModel<String>(
+              user, "password")));
+    }
+
+    @Override
+    protected void onSubmit() {
+      ((SignInSession) getSession()).signIn(user.getUsername(), 
user.getPassword());
+
+      if (((SignInSession) getSession()).getUser() != null) {
+        continueToOriginalDestination();
+        setResponsePage(getApplication().getHomePage());
+      } else
+        // Pass error message to feedback panel
+        error("Invalid username or password");
+    }
+
+  }
+
+  public User getUser() {
+    return user;
+  }
+
+  public void setUser(User user) {
+    this.user = user;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/SignInSession.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/auth/SignInSession.java 
b/src/java/org/apache/nutch/webui/pages/auth/SignInSession.java
new file mode 100644
index 0000000..6c77b3f
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/SignInSession.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.webui.pages.auth;
+
+import org.apache.nutch.webui.NutchUiApplication;
+import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
+import org.apache.wicket.authroles.authorization.strategies.role.Roles;
+import org.apache.wicket.request.Request;
+
+/**
+ * Checks for whether authenticate or not.
+ */
+public class SignInSession extends AuthenticatedWebSession {
+
+  private User user;
+
+  public SignInSession(Request request) {
+    super(request);
+  }
+
+  @Override
+  public boolean authenticate(final String username, final String password) {
+    NutchUiApplication application = (NutchUiApplication) 
NutchUiApplication.get();
+    user = application.getUser(username, password);
+
+    return user != null;
+  }
+
+  @Override
+  public Roles getRoles() {
+    return null;
+  }
+
+  public User getUser() {
+    return user;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/User.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/auth/User.java 
b/src/java/org/apache/nutch/webui/pages/auth/User.java
new file mode 100644
index 0000000..d0aee43
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/User.java
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nutch.webui.pages.auth;
+
+import java.io.Serializable;
+
+/**
+ * User bean for authentication.
+ */
+public class User implements Serializable {
+
+  private String username;
+  private String password;
+
+  public User() {
+
+  }
+
+  public User(String username, String password) {
+    this.username = username;
+    this.password = password;
+  }
+
+  public String getUsername() {
+    return username;
+  }
+
+  public void setUsername(String username) {
+    this.username = username;
+  }
+
+  public String getPassword() {
+    return password;
+  }
+
+  public void setPassword(String password) {
+    this.password = password;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/nutch/blob/def06773/src/java/org/apache/nutch/webui/pages/auth/package-info.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/nutch/webui/pages/auth/package-info.java 
b/src/java/org/apache/nutch/webui/pages/auth/package-info.java
new file mode 100644
index 0000000..009810e
--- /dev/null
+++ b/src/java/org/apache/nutch/webui/pages/auth/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Contains authorization classes for Web UI
+ */
+package org.apache.nutch.webui.pages.auth;
+

Reply via email to