RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
TokenCacheKey.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 TOKENCACHEKEY_H
10 #define TOKENCACHEKEY_H
11 
12 #include <functional>
13 #include "types.h"
14 #include "TokenSubjectType.h"
15 #include "utils.h"
16 #include "UserInfo.h"
17 #include "Logger.h"
18 
19 namespace rmsauth {
20 
21 class TokenCacheKey;
22 using TokenCacheKeyPtr = ptr<TokenCacheKey>;
23 
25 {
26  static const String& Tag() {static const String tag="TokenCacheKey"; return tag;}
27 
28  String authority_;
29  String resource_;
30  String clientId_;
31  String uniqueId_;
32  //String displayableId_;
33  TokenSubjectType tokenSubjectType_;
34 
35 public:
36  TokenCacheKey() = default;
37  TokenCacheKey(const String& authority, const String& resource, const String& clientId, const TokenSubjectType tokenSubjectType, const UserInfoPtr userInfo);
38  TokenCacheKey(const String& authority, const String& resource, const String& clientId, const TokenSubjectType tokenSubjectType, const String& uniqueId);
39 
40  const String& authority() const { return authority_; }
41  const String& resource() const { return resource_; }
42  const String& clientId() const { return clientId_; }
43  const String& uniqueId() const { return uniqueId_; }
44  //const String& displayableId() const { return displayableId_; }
45  TokenSubjectType tokenSubjectType() const { return tokenSubjectType_; }
46 
47  bool equals(const TokenCacheKey& other) const;
48  bool operator==(const TokenCacheKey &other) const;
49  std::size_t getHashCode() const;
50 };
51 
52 } // namespace rmsauth {
53 
54 namespace std {
55 
57 template <>
58 struct hash<rmsauth::TokenCacheKey>
59 {
60  size_t operator()(const rmsauth::TokenCacheKey& k) const
61  {
62  return (k.getHashCode());
63  }
64 };
66 
67 }
68 
69 #endif // TOKENCACHEKEY_H
Definition: TokenCacheKey.h:54
Definition: AcquireTokenForClientHandler.h:14
Definition: TokenCacheKey.h:24