1 /* ownCloud Android Library is available under MIT license
2 * Copyright (C) 2014 ownCloud (http://www.owncloud.org/)
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 package com
.owncloud
.android
.oc_framework
.accounts
;
27 import android
.accounts
.Account
;
28 import android
.os
.Parcel
;
29 import android
.os
.Parcelable
;
32 * Account with extra information specific for ownCloud accounts.
34 * TODO integrate in the main app
36 * @author David A. Velasco
38 public class OwnCloudAccount
extends Account
{
40 public static class Constants
{
42 * Value under this key should handle path to webdav php script. Will be
43 * removed and usage should be replaced by combining
44 * {@link com.owncloud.android.authentication.AuthenticatorActivity.KEY_OC_BASE_URL} and
45 * {@link com.owncloud.android.oc_framework.utils.utils.OwnCloudVersion}
49 public static final String KEY_OC_URL
= "oc_url";
51 * Version should be 3 numbers separated by dot so it can be parsed by
52 * {@link com.owncloud.android.oc_framework.utils.utils.OwnCloudVersion}
54 public static final String KEY_OC_VERSION
= "oc_version";
56 * Base url should point to owncloud installation without trailing / ie:
57 * http://server/path or https://owncloud.server
59 public static final String KEY_OC_BASE_URL
= "oc_base_url";
61 * Flag signaling if the ownCloud server can be accessed with OAuth2 access tokens.
63 public static final String KEY_SUPPORTS_OAUTH2
= "oc_supports_oauth2";
65 * Flag signaling if the ownCloud server can be accessed with session cookies from SAML-based web single-sign-on.
67 public static final String KEY_SUPPORTS_SAML_WEB_SSO
= "oc_supports_saml_web_sso";
70 private String mAuthTokenType
;
72 public OwnCloudAccount(String name
, String type
, String authTokenType
) {
74 // TODO validate authTokentype as supported
75 mAuthTokenType
= authTokenType
;
79 * Reconstruct from parcel
81 * @param source The source parcel
83 public OwnCloudAccount(Parcel source
) {
85 mAuthTokenType
= source
.readString();
89 public void writeToParcel(Parcel dest
, int flags
) {
90 super.writeToParcel(dest
, flags
);
91 dest
.writeString(mAuthTokenType
);
95 public String
getAuthTokenType() {
96 return mAuthTokenType
;
100 public static final Parcelable
.Creator
<OwnCloudAccount
> CREATOR
= new Parcelable
.Creator
<OwnCloudAccount
>() {
102 public OwnCloudAccount
createFromParcel(Parcel source
) {
103 return new OwnCloudAccount(source
);
107 public OwnCloudAccount
[] newArray(int size
) {
108 return new OwnCloudAccount
[size
];