comparison Plugin/AuthorizationWebService.h @ 74:aa73b10c2db9

new API route to decode tokens
author Alain Mazy <am@osimis.io>
date Fri, 03 Mar 2023 18:03:22 +0100
parents 512247750f0a
children 7381a7674b36
comparison
equal deleted inserted replaced
73:512247750f0a 74:aa73b10c2db9
29 std::string username_; 29 std::string username_;
30 std::string password_; 30 std::string password_;
31 std::string identifier_; 31 std::string identifier_;
32 std::string userProfileUrl_; 32 std::string userProfileUrl_;
33 std::string tokenValidationUrl_; 33 std::string tokenValidationUrl_;
34 std::string tokenDecoderUrl_;
34 std::string tokenCreationBaseUrl_; 35 std::string tokenCreationBaseUrl_;
35 36
36 protected: 37 protected:
37 virtual bool IsGrantedInternal(unsigned int& validity, 38 virtual bool IsGrantedInternal(unsigned int& validity,
38 OrthancPluginHttpMethod method, 39 OrthancPluginHttpMethod method,
51 const std::string& tokenValue) ORTHANC_OVERRIDE; 52 const std::string& tokenValue) ORTHANC_OVERRIDE;
52 53
53 public: 54 public:
54 AuthorizationWebService(const std::string& tokenValidationUrl, 55 AuthorizationWebService(const std::string& tokenValidationUrl,
55 const std::string& tokenCreationBaseUrl, 56 const std::string& tokenCreationBaseUrl,
56 const std::string& userProfileUrl) : 57 const std::string& userProfileUrl,
58 const std::string& tokenDecoderUrl) :
57 userProfileUrl_(userProfileUrl), 59 userProfileUrl_(userProfileUrl),
58 tokenValidationUrl_(tokenValidationUrl), 60 tokenValidationUrl_(tokenValidationUrl),
61 tokenDecoderUrl_(tokenDecoderUrl),
59 tokenCreationBaseUrl_(tokenCreationBaseUrl) 62 tokenCreationBaseUrl_(tokenCreationBaseUrl)
60 { 63 {
61 } 64 }
62 65
63 void SetCredentials(const std::string& username, 66 void SetCredentials(const std::string& username,
85 const std::string& id, 88 const std::string& id,
86 const std::vector<IAuthorizationService::OrthancResource>& resources, 89 const std::vector<IAuthorizationService::OrthancResource>& resources,
87 const std::string& expirationDateString, 90 const std::string& expirationDateString,
88 const uint64_t& validityDuration) ORTHANC_OVERRIDE; 91 const uint64_t& validityDuration) ORTHANC_OVERRIDE;
89 92
93 virtual bool DecodeToken(DecodedToken& response,
94 const std::string& tokenKey,
95 const std::string& tokenValue);
96
90 }; 97 };
91 } 98 }