1 /* ownCloud Android client application
2 * Copyright (C) 2012-2013 ownCloud Inc.
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2,
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package com
.owncloud
.android
.oc_framework
.accounts
;
20 import android
.accounts
.Account
;
21 import android
.os
.Parcel
;
22 import android
.os
.Parcelable
;
25 * Account with extra information specific for ownCloud accounts.
27 * TODO integrate in the main app
29 * @author David A. Velasco
31 public class OwnCloudAccount
extends Account
{
33 public static class Constants
{
35 * Value under this key should handle path to webdav php script. Will be
36 * removed and usage should be replaced by combining
37 * {@link com.owncloud.android.authentication.AuthenticatorActivity.KEY_OC_BASE_URL} and
38 * {@link com.owncloud.android.oc_framework.utils.utils.OwnCloudVersion}
42 public static final String KEY_OC_URL
= "oc_url";
44 * Version should be 3 numbers separated by dot so it can be parsed by
45 * {@link com.owncloud.android.oc_framework.utils.utils.OwnCloudVersion}
47 public static final String KEY_OC_VERSION
= "oc_version";
49 * Base url should point to owncloud installation without trailing / ie:
50 * http://server/path or https://owncloud.server
52 public static final String KEY_OC_BASE_URL
= "oc_base_url";
54 * Flag signaling if the ownCloud server can be accessed with OAuth2 access tokens.
56 public static final String KEY_SUPPORTS_OAUTH2
= "oc_supports_oauth2";
58 * Flag signaling if the ownCloud server can be accessed with session cookies from SAML-based web single-sign-on.
60 public static final String KEY_SUPPORTS_SAML_WEB_SSO
= "oc_supports_saml_web_sso";
63 private String mAuthTokenType
;
65 public OwnCloudAccount(String name
, String type
, String authTokenType
) {
67 // TODO validate authTokentype as supported
68 mAuthTokenType
= authTokenType
;
72 * Reconstruct from parcel
74 * @param source The source parcel
76 public OwnCloudAccount(Parcel source
) {
78 mAuthTokenType
= source
.readString();
82 public void writeToParcel(Parcel dest
, int flags
) {
83 super.writeToParcel(dest
, flags
);
84 dest
.writeString(mAuthTokenType
);
88 public String
getAuthTokenType() {
89 return mAuthTokenType
;
93 public static final Parcelable
.Creator
<OwnCloudAccount
> CREATOR
= new Parcelable
.Creator
<OwnCloudAccount
>() {
95 public OwnCloudAccount
createFromParcel(Parcel source
) {
96 return new OwnCloudAccount(source
);
100 public OwnCloudAccount
[] newArray(int size
) {
101 return new OwnCloudAccount
[size
];