RMS SDK for C++  0.2.1
A client library for using Microsoft RMS from Linux.
FileCache.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 FILECACHE_H
10 #define FILECACHE_H
11 
12 #include "types.h"
13 #include "TokenCache.h"
14 #include "rmsauthExport.h"
15 
16 namespace rmsauth {
17 
18 class RMSAUTH_EXPORT FileCache : public TokenCache
19 {
20 protected:
21  static const String Tag() { static const String tag = "FileCache"; return tag;}
22  String cacheFilePath_;
23  static Mutex fileLock_;
24 
25 public:
26  FileCache(const String& filePath = "");
27  void clear() override;
28 
29 protected:
30  virtual void readCache();
31  virtual void writeCache();
32 
33 private:
34  virtual void onBeforeAccess(const TokenCacheNotificationArgs& args) override;
35  virtual void onAfterAccess(const TokenCacheNotificationArgs& args) override;
36  virtual const String getCacheName() const override {return FileCache::Tag();}
37 };
38 
39 } // namespace rmsauth {
40 
41 #endif // FILECACHE_H
Definition: TokenCache.h:24
Definition: TokenCacheNotificationArgs.h:18
Definition: FileCache.h:18
Definition: AcquireTokenForClientHandler.h:14