AAA-159: Switch to using gson for JSON serialization
[aaa.git] / aaa-shiro / impl / src / main / java / org / opendaylight / aaa / shiro / keystone / domain / KeystoneToken.java
1 /*
2  * Copyright (c) 2017 Ericsson Inc.  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.aaa.shiro.keystone.domain;
10
11 import java.util.ArrayList;
12 import java.util.List;
13
14 /**
15  * This class represents a Keystone API v3 Token object.
16  */
17 public class KeystoneToken {
18     private Token token;
19
20     public KeystoneToken() {}
21
22     public KeystoneToken(Token theToken) {
23         token = theToken;
24     }
25
26     public void setToken(Token theToken) {
27         token = theToken;
28     }
29
30     public Token getToken() {
31         return token;
32     }
33
34     public static final class Token {
35
36         private List<Role> roles = new ArrayList<>();
37
38         public Token() {}
39
40         public Token(List<Role> theRoles) {
41             roles.addAll(theRoles);
42         }
43
44         public void addRoles(List<Role> theRoles) {
45             roles.addAll(theRoles);
46         }
47
48         public List<Role> getRoles() {
49             return roles;
50         }
51
52         public static final class Role {
53             private String name;
54
55             private String id;
56
57             public Role() {}
58
59             public Role(String theRoleName, String theId) {
60                 name = theRoleName;
61                 id = theId;
62             }
63
64             public void setName(String theRoleName) {
65                 name = theRoleName;
66             }
67
68             public String getName() {
69                 return name;
70             }
71
72             public void setId(String theId) {
73                 id = theId;
74             }
75
76             public String getId() {
77                 return id;
78             }
79         }
80     }
81 }