/** * Constructor for non yet saved OC accounts. * * @param baseUri URI to the OC server to get access to. * @param credentials Credentials to authenticate in the server. NULL is valid for anonymous credentials. */ public OwnCloudAccount(Uri baseUri, OwnCloudCredentials credentials) { if (baseUri == null) { throw new IllegalArgumentException("Parameter 'baseUri' cannot be null"); } mSavedAccount = null; mSavedAccountName = null; mBaseUri = baseUri; mCredentials = credentials != null ? credentials : OwnCloudCredentialsFactory.getAnonymousCredentials(); String username = mCredentials.getUsername(); if (username != null) { mSavedAccountName = AccountUtils.buildAccountName(mBaseUri, username); } }
/** * Constructor for non yet saved OC accounts. * * @param baseUri URI to the OC server to get access to. * @param credentials Credentials to authenticate in the server. NULL is valid for anonymous credentials. */ public OwnCloudAccount(Uri baseUri, OwnCloudCredentials credentials) { if (baseUri == null) { throw new IllegalArgumentException("Parameter 'baseUri' cannot be null"); } mSavedAccount = null; mSavedAccountName = null; mBaseUri = baseUri; mCredentials = credentials != null ? credentials : OwnCloudCredentialsFactory.getAnonymousCredentials(); String username = mCredentials.getUsername(); if (username != null) { mSavedAccountName = AccountUtils.buildAccountName(mBaseUri, username); } }
@Override public OwnCloudClient getClientFor(OwnCloudAccount account, Context context, boolean useNextcloudUserAgent) throws AccountNotFoundException, OperationCanceledException, AuthenticatorException, IOException { Log_OC.d(TAG, "getClientFor(OwnCloudAccount ... : "); OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(account.getBaseUri(), context.getApplicationContext(), true, useNextcloudUserAgent); Log_OC.v(TAG, " new client {" + (account.getName() != null ? account.getName() : AccountUtils.buildAccountName(account.getBaseUri(), "") ) + ", " + client.hashCode() + "}"); if (account.getCredentials() == null) { account.loadCredentials(context); } client.setCredentials(account.getCredentials()); return client; }
String accountName = account.getName(); String sessionName = account.getCredentials() == null ? "" : AccountUtils.buildAccountName( account.getBaseUri(), account.getCredentials().getAuthToken()
String accountName = account.getName(); String sessionName = account.getCredentials() == null ? "" : AccountUtils.buildAccountName( account.getBaseUri(), account.getCredentials().getAuthToken());
@Override public OwnCloudClient getClientFor(OwnCloudAccount account, Context context) throws OperationCanceledException, AuthenticatorException, IOException { Log_OC.d(TAG, "getClientFor(OwnCloudAccount ... : "); OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient( account.getBaseUri(), context.getApplicationContext(), true); Log_OC.v(TAG, " new client {" + (account.getName() != null ? account.getName() : AccountUtils.buildAccountName(account.getBaseUri(), "") ) + ", " + client.hashCode() + "}"); if (account.getCredentials() == null) { account.loadCredentials(context); } client.setCredentials(account.getCredentials()); client.setAccount(account); client.setContext(context); client.setOwnCloudClientManager(this); return client; }