hc
2023-11-07 f45e756958099c35d6afb746df1d40a1c6302cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/**
 * Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * You may not use this file except in compliance with the License. A copy of the License is located the "LICENSE.txt"
 * file accompanying this source. This file 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 com.rockchip.alexa.jacky.info;
 
import com.rockchip.alexa.jacky.app.AuthConstants;
 
import org.json.JSONException;
import org.json.JSONObject;
 
public class CompanionProvisioningInfo {
    private String sessionId;
    private String clientId;
    private String redirectUri;
    private String authCode;
    private String codeVerifier;
 
    public CompanionProvisioningInfo(String sessionId, String clientId, String redirectUri, String authCode, String codeVerifier) {
        this.sessionId = sessionId;
        this.clientId = clientId;
        this.redirectUri = redirectUri;
        this.authCode = authCode;
        this.codeVerifier = codeVerifier;
    }
 
    public String getSessionId() {
        return sessionId;
    }
 
    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }
 
    public String getClientId() {
        return clientId;
    }
 
    public void setClientId(String clientId) {
        this.clientId = clientId;
    }
 
    public String getRedirectUri() {
        return redirectUri;
    }
 
    public void setRedirectUri(String redirectUri) {
        this.redirectUri = redirectUri;
    }
 
    public String getAuthCode() {
        return authCode;
    }
 
    public void setAuthCode(String authCode) {
        this.authCode = authCode;
    }
 
    public String getCodeVerifier() {
        return codeVerifier;
    }
 
    public void setCodeVerifier(String codeVerifier) {
        this.codeVerifier = codeVerifier;
    }
 
    public JSONObject toJson() {
        try {
            JSONObject jsonObject = new JSONObject();
            jsonObject.put(AuthConstants.AUTH_CODE, authCode);
            jsonObject.put(AuthConstants.CLIENT_ID, clientId);
            jsonObject.put(AuthConstants.REDIRECT_URI, redirectUri);
            jsonObject.put(AuthConstants.SESSION_ID, sessionId);
            jsonObject.put(AuthConstants.CODE_VERIFIER, codeVerifier);
            return jsonObject;
        } catch (JSONException e) {
            return null;
        }
    }
}