|
1 /** |
|
2 * Copyright (c) 2012-2013, Gerald Garcia |
|
3 * |
|
4 * This file is part of Andoid Caldav Sync Adapter Free. |
|
5 * |
|
6 * Andoid Caldav Sync Adapter Free is free software: you can redistribute |
|
7 * it and/or modify it under the terms of the GNU General Public License |
|
8 * as published by the Free Software Foundation, either version 3 of the |
|
9 * License, or at your option any later version. |
|
10 * |
|
11 * Andoid Caldav Sync Adapter Free is distributed in the hope that |
|
12 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
|
13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 * GNU General Public License for more details. |
|
15 * |
|
16 * You should have received a copy of the GNU General Public License |
|
17 * along with Andoid Caldav Sync Adapter Free. |
|
18 * If not, see <http://www.gnu.org/licenses/>. |
|
19 * |
|
20 */ |
|
21 |
|
22 package org.gege.caldavsyncadapter.authenticator; |
|
23 |
|
24 |
|
25 |
|
26 import android.accounts.AbstractAccountAuthenticator; |
|
27 import android.accounts.Account; |
|
28 import android.accounts.AccountAuthenticatorResponse; |
|
29 import android.accounts.AccountManager; |
|
30 import android.accounts.NetworkErrorException; |
|
31 import android.content.Context; |
|
32 import android.content.Intent; |
|
33 import android.os.Bundle; |
|
34 import android.util.Log; |
|
35 |
|
36 public class Authenticator extends AbstractAccountAuthenticator { |
|
37 |
|
38 private static final String TAG = "Authenticator"; |
|
39 private Context mContext; |
|
40 |
|
41 public Authenticator(Context context) { |
|
42 super(context); |
|
43 |
|
44 mContext = context; |
|
45 } |
|
46 |
|
47 @Override |
|
48 public Bundle addAccount(AccountAuthenticatorResponse response, |
|
49 String accountType, String authTokenType, |
|
50 String[] requiredFeatures, Bundle options) |
|
51 throws NetworkErrorException { |
|
52 |
|
53 |
|
54 Log.v(TAG, "addAccount()"); |
|
55 |
|
56 final Intent intent = new Intent(mContext, AuthenticatorActivity.class); |
|
57 intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); |
|
58 final Bundle bundle = new Bundle(); |
|
59 bundle.putParcelable(AccountManager.KEY_INTENT, intent); |
|
60 return bundle; |
|
61 |
|
62 } |
|
63 |
|
64 @Override |
|
65 public Bundle confirmCredentials(AccountAuthenticatorResponse response, |
|
66 Account account, Bundle options) throws NetworkErrorException { |
|
67 // TODO Auto-generated method stub |
|
68 return null; |
|
69 } |
|
70 |
|
71 @Override |
|
72 public Bundle editProperties(AccountAuthenticatorResponse response, |
|
73 String accountType) { |
|
74 // TODO Auto-generated method stub |
|
75 return null; |
|
76 } |
|
77 |
|
78 @Override |
|
79 public Bundle getAuthToken(AccountAuthenticatorResponse response, |
|
80 Account account, String authTokenType, Bundle options) |
|
81 throws NetworkErrorException { |
|
82 // TODO Auto-generated method stub |
|
83 return null; |
|
84 } |
|
85 |
|
86 @Override |
|
87 public String getAuthTokenLabel(String authTokenType) { |
|
88 // TODO Auto-generated method stub |
|
89 return null; |
|
90 } |
|
91 |
|
92 @Override |
|
93 public Bundle hasFeatures(AccountAuthenticatorResponse response, |
|
94 Account account, String[] features) throws NetworkErrorException { |
|
95 // TODO Auto-generated method stub |
|
96 return null; |
|
97 } |
|
98 |
|
99 @Override |
|
100 public Bundle updateCredentials(AccountAuthenticatorResponse response, |
|
101 Account account, String authTokenType, Bundle options) |
|
102 throws NetworkErrorException { |
|
103 // TODO Auto-generated method stub |
|
104 return null; |
|
105 } |
|
106 |
|
107 } |