OpenDaylight Controller functional modules.
[controller.git] / opendaylight / usermanager / src / main / java / org / opendaylight / controller / usermanager / internal / AuthorizationConfig.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.usermanager.internal;
10
11
12 /**
13  * Configuration Java Object which represents a Local configured Authorization
14  * for a remote authenticated user for User Manager.
15  */
16 public class AuthorizationConfig extends UserConfig {
17         private static final long serialVersionUID = 1L;
18
19         public AuthorizationConfig() {
20                 super();
21         }
22
23         // Constructor may be needed for autocontainer logic
24         public AuthorizationConfig(String user, String role) {
25                 super();
26                 this.user = user;
27                 this.role = role;
28         }
29
30         @Override
31         public boolean isValid() {
32                 return (user != null && !user.isEmpty() && role != null && !role
33                                 .isEmpty());
34         }
35
36         public String getRolesData() {
37                 return (role.replace(",", " "));
38         }
39
40         public String toString() {
41                 return "AuthorizationConfig=[user: " + user + ", role: " + role + "]";
42         }
43 }