本文整理汇总了Java中com.owncloud.android.lib.common.OwnCloudCredentialsFactory.newBasicCredentials方法的典型用法代码示例。如果您正苦于以下问题:Java OwnCloudCredentialsFactory.newBasicCredentials方法的具体用法?Java OwnCloudCredentialsFactory.newBasicCredentials怎么用?Java OwnCloudCredentialsFactory.newBasicCredentials使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.owncloud.android.lib.common.OwnCloudCredentialsFactory
的用法示例。
在下文中一共展示了OwnCloudCredentialsFactory.newBasicCredentials方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
mSSMgr = new SingleSessionManager();
mServerUri = Uri.parse(getContext().getString(R.string.server_base_url));
mUsername = getContext().getString(R.string.username);
mValidAccount = new OwnCloudAccount(
mServerUri, OwnCloudCredentialsFactory.newBasicCredentials(
mUsername,
getContext().getString(R.string.password)
)
);
mAnonymousAccount = new OwnCloudAccount(
mServerUri, OwnCloudCredentialsFactory.getAnonymousCredentials());
}
示例2: setUp
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
mSFMgr = new SimpleFactoryManager();
mServerUri = Uri.parse(getContext().getString(R.string.server_base_url));
mUsername = getContext().getString(R.string.username);
mValidAccount = new OwnCloudAccount(
mServerUri, OwnCloudCredentialsFactory.newBasicCredentials(
mUsername,
getContext().getString(R.string.password)
)
);
mAnonymousAccount = new OwnCloudAccount(
mServerUri, OwnCloudCredentialsFactory.getAnonymousCredentials());
}
示例3: testGetSetCredentials
import com.owncloud.android.lib.common.OwnCloudCredentialsFactory; //导入方法依赖的package包/类
public void testGetSetCredentials() {
OwnCloudClient client =
new OwnCloudClient(mServerUri, NetworkUtils.getMultiThreadedConnManager());
assertNotNull("Returned NULL credentials", client.getCredentials());
assertEquals("Not instanced without credentials",
client.getCredentials(), OwnCloudCredentialsFactory.getAnonymousCredentials());
OwnCloudCredentials credentials =
OwnCloudCredentialsFactory.newBasicCredentials("user", "pass");
client.setCredentials(credentials);
assertEquals("Basic credentials not set", credentials, client.getCredentials());
credentials = OwnCloudCredentialsFactory.newBearerCredentials("bearerToken");
client.setCredentials(credentials);
assertEquals("Bearer credentials not set", credentials, client.getCredentials());
credentials = OwnCloudCredentialsFactory.newSamlSsoCredentials("samlSessionCookie=124");
client.setCredentials(credentials);
assertEquals("SAML2 session credentials not set", credentials, client.getCredentials());
}