RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
AuthenticationContext.h
1 /*
2  * ======================================================================
3  * Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
4  * Licensed under the MIT License.
5  * See LICENSE.md in the project root for license information.
6  * ======================================================================
7 */
8 
9 #ifndef AUTHENTICATIONCONTEXT_H
10 #define AUTHENTICATIONCONTEXT_H
11 
12 #include "types.h"
13 #include "AuthenticationResult.h"
14 #include "Authenticator.h"
15 #include "PromptBehavior.h"
16 #include "UserIdentifier.h"
17 #include "TokenCache.h"
18 #include "Guid.h"
19 #include "AcquireTokenInteractiveHandler.h"
20 #include "AcquireTokenNonInteractiveHandler.h"
21 #include "AcquireTokenForClientHandler.h"
22 #include "rmsauthExport.h"
23 
24 namespace rmsauth {
25 
26 enum class AuthorityValidationType
27 {
28  True,
29  False,
30  NotProvided
31 };
32 
33 
34 class RMSAUTH_EXPORT AuthenticationContext
35 {
36  static const String& Tag() {static const String tag="AuthenticationContext"; return tag;}
37 
38  AuthenticatorPtr authenticator_;
39  TokenCachePtr tokenCache_;
40 
41 public:
42  AuthenticationContext(const String& authority, TokenCachePtr tokenCache);
43  AuthenticationContext(const String& authority, AuthorityValidationType validateAuthority, TokenCachePtr tokenCache);
44 
45  AuthenticationResultPtr acquireToken(const String& resource, const String& clientId, const String& redirectUri, PromptBehavior promptBehavior, const String& userId = "");
46  AuthenticationResultPtr acquireToken(const String& resource, const String& clientId, UserCredentialPtr userCredentiar);
47  AuthenticationResultPtr acquireToken(const String& resource, const String& clientId, UserAssertionPtr userAssertion);
48  AuthenticationResultPtr acquireToken(const String& resource, ClientCredentialPtr clientCredential);
49 
50 private:
51  AuthenticationResultPtr acquireTokenCommonAsync(const String& resource, const String& clientId, const String& redirectUri, PromptBehavior promptBehavior, UserIdentifierPtr userId, const String& extraQueryParameters, bool callSync = false);
52  AuthenticationResultPtr acquireTokenCommonAsync(const String& resource, const String& clientId, UserCredentialPtr userCredential, bool callSync = false);
53  AuthenticationResultPtr acquireTokenCommonAsync(const String& resource, const String& clientId, UserAssertionPtr userAssertionl, bool callSync = false);
54  AuthenticationResultPtr acquireTokenCommonAsync(const String& resource, ClientCredentialPtr clientCredential, bool callSync = false);
55 
56  static IWebUIPtr createWebAuthenticationDialog(PromptBehavior promptBehavior);
57 };
58 
59 } // namespace rmsauth {
60 
61 #endif // AUTHENTICATIONCONTEXT_H
Definition: AuthenticationContext.h:34
Definition: AcquireTokenForClientHandler.h:14