本文整理汇总了Java中com.microsoft.aad.adal.AuthenticationSettings类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationSettings类的具体用法?Java AuthenticationSettings怎么用?Java AuthenticationSettings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationSettings类属于com.microsoft.aad.adal包,在下文中一共展示了AuthenticationSettings类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: check
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
/**
* Checks if the Broker has the permissions needed be used.
*
* @throws ClientAuthenticatorException If the required permissions are not available
*/
public void check() throws ClientAuthenticatorException {
if (!AuthenticationSettings.INSTANCE.getSkipBroker()) {
mLogger.logDebug("Checking permissions for use with the ADAL Broker.");
for (final String permission : mBrokerRequirePermissions) {
if (ContextCompat.checkSelfPermission(mContext, permission) == PackageManager.PERMISSION_DENIED) {
final String message = String.format(
"Required permissions to use the Broker are denied: %s, see %s for more details.",
permission,
mAdalProjectUrl);
mLogger.logDebug(message);
throw new ClientAuthenticatorException(message, OneDriveErrorCodes.AuthenicationPermissionsDenied);
}
}
mLogger.logDebug("All required permissions found.");
}
}
示例2: onCreate
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(handler);
// Devices with API level lower than 18 must setup an encryption key.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2
&& AuthenticationSettings.INSTANCE.getSecretKeyData() == null) {
AuthenticationSettings.INSTANCE.setSecretKey(generateSecretKey());
}
// We're not using Microsoft Intune's Company portal app,
// skip the broker check so we don't get warnings about the following permissions
// in manifest:
// GET_ACCOUNTS
// USE_CREDENTIALS
// MANAGE_ACCOUNTS
AuthenticationSettings.INSTANCE.setSkipBroker(true);
}
示例3: configureAuthSettings
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
public static void configureAuthSettings(OperationListActivity activity) {
// Devices with API level lower than 18 must setup an encryption key.
if (Build.VERSION.SDK_INT < MIN_VERSION_CODE_FOR_ENCRYPT && AuthenticationSettings.INSTANCE.getSecretKeyData() == null) {
AuthenticationSettings.INSTANCE.setSecretKey(generateSecretKey());
}
// We're not using Microsoft Intune's Company portal app,
// skip the broker check so we don't get warnings about the following permissions
// in manifest:
// GET_ACCOUNTS
// USE_CREDENTIALS
// MANAGE_ACCOUNTS
AuthenticationSettings.INSTANCE.setSkipBroker(true);
}
示例4: setupKeyForSample
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
public static void setupKeyForSample() throws NoSuchAlgorithmException,
InvalidKeySpecException, UnsupportedEncodingException {
if (AuthenticationSettings.INSTANCE.getSecretKeyData() == null) {
// use same key for tests
SecretKeyFactory keyFactory = SecretKeyFactory
.getInstance("PBEWithSHA256And256BitAES-CBC-BC");
SecretKey tempkey = keyFactory.generateSecret(new PBEKeySpec("test".toCharArray(),
"abcdedfdfd".getBytes("UTF-8"), 100, 256));
SecretKey secretKey = new SecretKeySpec(tempkey.getEncoded(), "AES");
AuthenticationSettings.INSTANCE.setSecretKey(secretKey.getEncoded());
}
}
示例5: onCreate
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
if (Preference.isFirstTime(this))
{
Preference.hasFirstTime(this);
SinglePaneActivity.start(IntroductionFragment.class, this);
finish();
}
else
{
// Silence login is not working well, refreshing token is always needed.
// if (Preference.getUID(this)!=null) {
// OfficeAuthenticationHelper.acquireTokenSilent(this,Preference.getUID(this),this);
// } else {
if (!NetworkHelper.checkNetwork(this)) {
Toast.makeText(this,R.string.invalidNetwork,Toast.LENGTH_SHORT).show();
SinglePaneActivity.start(IntroductionFragment.class, this);
finish();
}
else
{
// Devices with API level lower than 18 must setup an encryption key.
if (Build.VERSION.SDK_INT < 18 && AuthenticationSettings.INSTANCE.getSecretKeyData() == null) {
AuthenticationSettings.INSTANCE.setSecretKey(generateSecretKey());
}
mAuthContext = OfficeAuthenticationHelper.acquireToken(this, this);
progressDialog = ProgressDialog.show(this,
getString(R.string.app_name), getString(R.string.app_loading), true, false);
}
// }
}
super.onCreate(savedInstanceState);
}
示例6: skipBroker
import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
public static void skipBroker(boolean shouldSkip) {
AuthenticationSettings.INSTANCE.setSkipBroker(shouldSkip);
}