本文整理汇总了Java中com.microsoft.aad.adal.AuthenticationContext类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationContext类的具体用法?Java AuthenticationContext怎么用?Java AuthenticationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationContext类属于com.microsoft.aad.adal包,在下文中一共展示了AuthenticationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log_out);
try {
Utils.setupKeyForSample();
mAuthContext = new AuthenticationContext(this, Constants.AUTHORITY_URL, false);
} catch (Exception e) {
Log.e(TAG, "Encryption related exception", e);
Toast.makeText(LogOutActivity.this, "Encryption related exception", Toast.LENGTH_LONG).show();
}
loginButton = (Button)findViewById(R.id.btnLogOut);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
login();
}
});
}
示例2: login
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
private void login() {
String authority = mAppPrefs.getString(Constants.AUTHORITY,"");
if (!authority.equals("")) {
try {
mAuthContext = new AuthenticationContext(SetupActivity.this, authority, false);
mProgressDialog.show();
// use the endpoint that the user entered in and use the username,
// as the hint that is automatically populated into the azure library's webview
mAuthContext.acquireToken(
SetupActivity.this,
mEndpoint,
Constants.CLIENT_ID,
Constants.REDIRECT_URI,
mUsername,
this
);
} catch (Exception ex) {
ex.getCause().printStackTrace();
}
}
else {
Toast.makeText(this, getString(R.string.authority_error), Toast.LENGTH_LONG).show();
}
}
示例3: providesAuthenticationContext
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
@SuppressWarnings("unused") // not actually unused -- used by Dagger
public AuthenticationContext providesAuthenticationContext() {
return new AuthenticationContext(
mBuilder.mActivity,
mBuilder.mAuthorityUrl,
mBuilder.mValidateAuthority);
}
示例4: providesAuthenticationManager
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
@SuppressWarnings("unused") // not actually unused -- used by Dagger
public AuthenticationManager providesAuthenticationManager(
AuthenticationContext authenticationContext) {
return new AuthenticationManager(
mBuilder.mActivity,
authenticationContext,
mBuilder.mAuthenticationResourceId,
mBuilder.mSharedPreferencesFilename,
mBuilder.mClientId,
mBuilder.mRedirectUri);
}
示例5: AuthenticationManager
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
AuthenticationManager(
Activity activity,
AuthenticationContext authenticationContext,
String authenticationResourceId,
String sharedPreferencesFilename,
String clientId,
String redirectUri) {
mActivity = activity;
mAuthenticationContext = authenticationContext;
mAuthenticationResourceId = authenticationResourceId;
mSharedPreferencesFilename = sharedPreferencesFilename;
mClientId = clientId;
mRedirectUri = redirectUri;
}
示例6: initialize
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
public static void initialize(Activity activity) {
mActivity = activity;
try {
mAADAuthContext = new AuthenticationContext(mActivity, Constants.AUTHORITY_URL, true);
} catch (Throwable e) {
logger.error("E2ETestApp", "Error creating AuthenticationContext: " + e.getMessage(), e);
}
}
示例7: providesAuthenticationContext
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
public AuthenticationContext providesAuthenticationContext() {
try {
return new AuthenticationContext(
mBuilder.mActivity,
mBuilder.mAuthorityUrl,
mBuilder.mValidateAuthority);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new RuntimeException(e);
}
}
示例8: providesAuthenticationManager
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
public AuthenticationManager providesAuthenticationManager(
AuthenticationContext authenticationContext) {
return new AuthenticationManager(
mBuilder.mActivity,
authenticationContext,
mBuilder.mAuthenticationResourceId,
mBuilder.mSharedPreferencesFilename,
mBuilder.mClientId,
mBuilder.mRedirectUri);
}
示例9: ADALDependencyResolver
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
/**
* Instantiates a new dependency resolver.
* @param context the context
* @param resourceId the resource id
* @param clientId the client id
*/
public ADALDependencyResolver(AuthenticationContext context, String resourceId, String clientId) {
super("");
this.context = context;
this.resourceId = resourceId;
this.clientId = clientId;
}
示例10: providesAuthenticationContext
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
@SuppressWarnings("unused") // not actually unused -- used by Dagger
public AuthenticationContext providesAuthenticationContext() {
try {
return new AuthenticationContext(
mBuilder.mActivity,
mBuilder.mAuthorityUrl,
mBuilder.mValidateAuthority);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
throw new RuntimeException(e);
}
}
示例11: newInstance
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
public static AuthenticationContext newInstance(Context context) {
try {
return new AuthenticationContext(context, Constants.AUTHORITY_URL, false);
} catch (NoSuchAlgorithmException | NoSuchPaddingException e) {
e.printStackTrace();
}
return null;
}
开发者ID:microsoftgraph,项目名称:android-java-meetingfeedback-rest-sample,代码行数:9,代码来源:AuthenticationContextBuilder.java
示例12: AuthenticationManager
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
public AuthenticationManager(DataStore dataStore, AuthenticationContext authenticationContext,
RatingServiceAlarmManager alarmManager) {
mDataStore = dataStore;
mAuthenticationContext = authenticationContext;
mAlarmManager = alarmManager;
mResourceId = Constants.MICROSOFT_GRAPH_RESOURCE_ID;
}
开发者ID:microsoftgraph,项目名称:android-java-meetingfeedback-rest-sample,代码行数:8,代码来源:AuthenticationManager.java
示例13: providesAuthenticationManager
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
@Provides
@Singleton
public AuthenticationManager providesAuthenticationManager(DataStore dataStore,
RatingServiceAlarmManager alarmManager) {
AuthenticationContext authenticationContext = AuthenticationContextBuilder.newInstance(mActivity);
return new AuthenticationManager(dataStore, authenticationContext, alarmManager);
}
示例14: initialize
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
/**
* Description: Calls AuthenticationContext.acquireToken(...) once to initialize with
* user's credentials and avoid interactive prompt on later calls.
* If all tokens expire, app must call initialize() again to prompt user interactively and
* set up authentication context.
*
* @return A signal to wait on before continuing execution.
*/
public SettableFuture<AuthenticationResult> initialize() {
final SettableFuture<AuthenticationResult> result = SettableFuture.create();
if (verifyAuthenticationContext()) {
AuthenticationContext authContext = getAuthenticationContext();
if (authContext != null)
authContext.acquireToken(
this.contextActivity,
this.resourceId,
Constants.CLIENT_ID,
Constants.REDIRECT_URI,
PromptBehavior.Auto,
new AuthenticationCallback<AuthenticationResult>() {
@Override
public void onSuccess(final AuthenticationResult authenticationResult) {
if (authenticationResult != null && authenticationResult.getStatus() == AuthenticationStatus.Succeeded) {
dependencyResolver = new ADALDependencyResolver(
getAuthenticationContext(),
resourceId,
Constants.CLIENT_ID);
O365ServicesManager.initialize(authenticationResult.getTenantId());
result.set(authenticationResult);
}
}
@Override
public void onError(Exception t) {
result.setException(t);
}
}
);
else
result.setException(new Throwable("Auth context verification failed. Did you set a context activity?"));
} else {
result.setException(new Throwable("Auth context verification failed. Did you set a context activity?"));
}
return result;
}
示例15: acquireToken
import com.microsoft.aad.adal.AuthenticationContext; //导入依赖的package包/类
/**
* Acquire token from server, callback obj should be passed to get token
*
* @param activity activity context
* @param callback callback of token acquire
* @return authenticationContext instance you need to use
*/
public static AuthenticationContext acquireToken(Activity activity, AuthenticationCallback callback)
{
if (getAuthenticationContext(activity) == null)
{
return null;
}
mAuthContext.acquireToken(activity, RESOURCE_ID, CLIENT_ID,
REDIRECT_URL, PromptBehavior.Auto, callback);
return mAuthContext;
}