]> git.basschouten.com Git - openhab-addons.git/blob
00fb40df5fdefd52140e82ebb59c0aeddbf3914f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.enphase.internal.dto;
14
15 /**
16  * Data class for Enphase Entrez Portal.
17  *
18  * @author Joe Inkenbrandt - Initial contribution
19  */
20 public class EntrezJwtDTO {
21
22     public class EntrezJwtHeaderDTO {
23         private String kid;
24         private String typ;
25         private String alg;
26
27         public String getKid() {
28             return kid;
29         }
30
31         public void setKid(final String kid) {
32             this.kid = kid;
33         }
34
35         public String getTyp() {
36             return typ;
37         }
38
39         public void setTyp(final String typ) {
40             this.typ = typ;
41         }
42
43         public String getAlg() {
44             return alg;
45         }
46
47         public void setAlg(final String alg) {
48             this.alg = alg;
49         }
50     }
51
52     public class EntrezJwtBodyDTO {
53         private String aud;
54         private String iss;
55         private String enphaseUser;
56         private Long exp;
57         private Long iat;
58         private String jti;
59         private String username;
60
61         public String getAud() {
62             return aud;
63         }
64
65         public void setAud(final String aud) {
66             this.aud = aud;
67         }
68
69         public String getIss() {
70             return iss;
71         }
72
73         public void setIss(final String iss) {
74             this.iss = iss;
75         }
76
77         public String getEnphaseUser() {
78             return enphaseUser;
79         }
80
81         public void setEnphaseUser(final String enphaseUser) {
82             this.enphaseUser = enphaseUser;
83         }
84
85         public Long getExp() {
86             return exp;
87         }
88
89         public void setExp(final Long exp) {
90             this.exp = exp;
91         }
92
93         public Long getIat() {
94             return iat;
95         }
96
97         public void setIat(final Long iat) {
98             this.iat = iat;
99         }
100
101         public String getJti() {
102             return jti;
103         }
104
105         public void setJti(final String jti) {
106             this.jti = jti;
107         }
108
109         public String getUsername() {
110             return username;
111         }
112
113         public void setUsername(final String username) {
114             this.username = username;
115         }
116     }
117
118     private final EntrezJwtHeaderDTO header;
119     private final EntrezJwtBodyDTO body;
120
121     public EntrezJwtDTO(final EntrezJwtHeaderDTO header, final EntrezJwtBodyDTO body) {
122         this.header = header;
123         this.body = body;
124     }
125
126     public boolean isValid() {
127         return header == null || body == null;
128     }
129
130     public EntrezJwtBodyDTO getBody() {
131         return body;
132     }
133
134     public EntrezJwtHeaderDTO getHeader() {
135         return header;
136     }
137 }