当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationSettings类代码示例

本文整理汇总了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.");
    }
}
 
开发者ID:OneDrive,项目名称:onedrive-sdk-android,代码行数:22,代码来源:BrokerPermissionsChecker.java

示例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);
}
 
开发者ID:mirontoli,项目名称:andpoint,代码行数:22,代码来源:O365APIsStart_Application.java

示例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);
}
 
开发者ID:OfficeDev,项目名称:O365-Android-Snippets,代码行数:15,代码来源:AuthUtil.java

示例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());
    }
}
 
开发者ID:AzureADQuickStarts,项目名称:B2C-NativeClient-Android,代码行数:13,代码来源:Utils.java

示例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);
	}
 
开发者ID:PacteraMobile,项目名称:pacterapulse-android,代码行数:36,代码来源:MainActivity.java

示例6: skipBroker

import com.microsoft.aad.adal.AuthenticationSettings; //导入依赖的package包/类
public static void skipBroker(boolean shouldSkip) {
    AuthenticationSettings.INSTANCE.setSkipBroker(shouldSkip);
}
 
开发者ID:OneNoteDev,项目名称:Android-REST-API-Explorer,代码行数:4,代码来源:AzureADModule.java


注:本文中的com.microsoft.aad.adal.AuthenticationSettings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。