Imported Upstream version 1.2.0
[platform/upstream/iotivity.git] / cloud / account / src / main / java / org / iotivity / cloud / accountserver / oauth / OAuthProvider.java
1 /*
2  * //******************************************************************
3  * //
4  * // Copyright 2016 Samsung Electronics All Rights Reserved.
5  * //
6  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7  * //
8  * // Licensed under the Apache License, Version 2.0 (the "License");
9  * // you may not use this file except in compliance with the License.
10  * // You may obtain a copy of the License at
11  * //
12  * //      http://www.apache.org/licenses/LICENSE-2.0
13  * //
14  * // Unless required by applicable law or agreed to in writing, software
15  * // distributed under the License is distributed on an "AS IS" BASIS,
16  * // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * // See the License for the specific language governing permissions and
18  * // limitations under the License.
19  * //
20  * //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21  */
22 package org.iotivity.cloud.accountserver.oauth;
23
24 import org.iotivity.cloud.accountserver.db.TokenTable;
25 import org.iotivity.cloud.accountserver.db.UserTable;
26
27 /**
28  *
29  * This class provides abstraction of APIs relating authorization for OAuth 2.0
30  *
31  */
32 public abstract interface OAuthProvider {
33
34     /**
35      * API to request access token
36      * 
37      * @param authCode
38      *            authorization code
39      * @param options
40      *            option field of region authserver url, apiserver url
41      * @return token information or error message if error occurs
42      */
43     public abstract TokenTable requestAccessTokenInfo(String authCode,
44             Object options);
45
46     /**
47      * API to request refresh token
48      * 
49      * @param refreshToken
50      *            Refresh token used to refresh the access token in cloud before
51      *            getting expired
52      * @return token information or error message if error occurs
53      */
54     public abstract TokenTable requestRefreshTokenInfo(String refreshToken);
55
56     /**
57      * API to get user information
58      * 
59      * @param accessToken
60      *            access token
61      * @param options
62      *            option field of region authserver url, apiserver url
63      * @return user information or error message if error occurs
64      */
65     public abstract UserTable requestGetUserInfo(String accessToken,
66             Object options);
67 }