RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
TokenCacheItem.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 TOKENCACHEITEM_H
10 #define TOKENCACHEITEM_H
11 
12 #include "types.h"
13 #include "AuthenticationResult.h"
14 #include "TokenCacheKey.h"
15 
16 namespace rmsauth {
17 
19 {
20  TokenCacheKey tokenCacheKey_;
21  AuthenticationResultPtr resultPtr_;
22 
23 public:
24  TokenCacheItem(const TokenCacheKey& key, AuthenticationResultPtr result);
25 
26  const TokenCacheKey& tokenCacheKey() const {return tokenCacheKey_;}
27  TokenCacheKey& tokenCacheKey() { return tokenCacheKey_; }
28  const AuthenticationResultPtr authenticationResult() const {return resultPtr_; }
29  AuthenticationResultPtr authenticationResult() { return resultPtr_;}
30 
31  const String& authority() const { return tokenCacheKey_.authority(); }
32  const String& clientId() const { return tokenCacheKey_.clientId(); }
33  DateTimeOffset expiresOn() const { return resultPtr_->expiresOn(); }
34  const String familyName() const { return resultPtr_->userInfo() != nullptr ? resultPtr_->userInfo()->familyName():""; }
35  const String givenName() const { return resultPtr_->userInfo() != nullptr ? resultPtr_->userInfo()->givenName():""; }
36  const String identityProvider() const { return resultPtr_->userInfo() != nullptr ? resultPtr_->userInfo()->identityProvider():""; }
37  bool isMultipleResourceRefreshToken() const { return resultPtr_->isMultipleResourceRefreshToken(); }
38  const String& resource() const { return tokenCacheKey_.resource(); }
39  const String& tenantId() const { return resultPtr_->tenantId(); }
40  const String& uniqueId() const { return tokenCacheKey_.uniqueId(); }
41  //const String& displayableId() const { return tokenCacheKey_.displayableId(); }
42  const String& accessToken() const { return resultPtr_->accessToken(); }
43  const String& refreshToken() const { return resultPtr_->refreshToken(); }
44  void refreshToken(const String& val) { resultPtr_->refreshToken(val); }
45  const String& idToken() const { return resultPtr_->idToken(); }
46  TokenSubjectType tokenSubjectType() const { return tokenCacheKey_.tokenSubjectType(); }
47 };
48 
49 using TokenCacheItemPtr = ptr<TokenCacheItem>;
50 
51 } // namespace rmsauth {
52 
53 #endif // TOKENCACHEITEM_H
Definition: TokenCacheItem.h:18
Definition: AcquireTokenForClientHandler.h:14
Definition: TokenCacheKey.h:24