RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
Authenticator.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 AUTHENTICATOR_H
10 #define AUTHENTICATOR_H
11 
12 #include "types.h"
13 #include "AuthorityType.h"
14 #include "Guid.h"
15 #include "CallState.h"
16 #include "Exceptions.h"
17 #include "AuthenticatorTemplateList.h"
18 #include "Constants.h"
19 #include "utils.h"
20 #include "Url.h"
21 
22 namespace rmsauth {
23 
25 {
26  static const String& Tag() {static const String tag="Authenticator"; return tag;}
27 
28  static const String tenantlessTenantName();
29 
30  static AuthenticatorTemplateList authenticatorTemplateList;
31  bool updatedFromTemplate_ = false;
32 
33  bool validateAuthority_;
34  bool default_ = true;
35  String authority_;
36  AuthorityType authorityType_;
37  bool isTenantless_;
38  String authorizationUri_;
39  String tokenUri_;
40  String userRealmUri_;
41  String selfSignedJwtAudience_;
42  Guid correlationId_;
43 
44 public:
45  Authenticator():default_(true){}
46  Authenticator(const String& authority, bool validateAuthority);
47 
48  const String& authority() const {return authority_;}
49  const AuthorityType& authorityType() const {return authorityType_;}
50  bool validateAuthority() const {return validateAuthority_;}
51  bool isTenantless() const {return isTenantless_;}
52  const String& authorizationUri() const {return authorizationUri_;}
53  const String& tokenUri() const {return tokenUri_;}
54  const String& userRealmUri() const {return userRealmUri_;}
55  const String& selfSignedJwtAudience() const {return selfSignedJwtAudience_;}
56  const Guid& correlationId() const {return correlationId_;}
57  void correlationId(const Guid& val) {correlationId_ = val;}
58 
59  void updateFromTemplateAsync(CallStatePtr callState);
60  void updateTenantId(const String& tenantId);
61 
62 private:
63  static AuthorityType detectAuthorityType(const String& authority);
64  static String canonicalizeUri(const String& uri);
65  static String replaceTenantlessTenant(const String& authority, const String& tenantId);
66  static bool isAdfsAuthority(const String& firstPath);
67 
68 };
69 
70 using AuthenticatorPtr = ptr<Authenticator>;
71 
72 } // namespace rmsauth {
73 
74 #endif // AUTHENTICATOR_H
Definition: AuthenticatorTemplateList.h:18
Definition: Authenticator.h:24
Definition: AcquireTokenForClientHandler.h:14
Definition: Guid.h:23