Auth Principal to work with Remote authorization
[controller.git] / opendaylight / usermanager / src / main / java / org / opendaylight / controller / usermanager / internal / ServerConfig.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.usermanager.internal;
11
12 import java.io.Serializable;
13
14 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
16
17 /**
18  * Configuration Java Object which represents a Remote AAA server configuration
19  * information for User Manager.
20  */
21 public class ServerConfig implements Serializable {
22     private static final long serialVersionUID = 1L;
23
24     // Order matters: JSP file expects following fields in the following order
25     private String ip;
26     private String secret;
27     private String protocol;
28
29     public ServerConfig() {
30     }
31
32     public ServerConfig(String ip, String secret, String protocol) {
33         this.ip = ip;
34         this.secret = secret;
35         this.protocol = protocol;
36     }
37     
38     public String getAddress() {
39         return ip;
40     }
41
42     public String getSecret() {
43         return secret;
44     }
45
46     public String getProtocol() {
47         return protocol;
48     }
49
50     @Override
51     public int hashCode() {
52         return HashCodeBuilder.reflectionHashCode(this);
53     }
54
55     @Override
56     public boolean equals(Object obj) {
57         return EqualsBuilder.reflectionEquals(this, obj);
58     }
59
60     public boolean isValid() {
61         return (ip != null && !ip.isEmpty() && secret != null && !secret
62                 .isEmpty());
63     }
64 }