FreeRDP
Loading...
Searching...
No Matches
RedirectWatcher Class Reference

#include <redirect_watcher.hpp>

Public Member Functions

 RedirectWatcher (std::string redirectUri)
 
bool matches (const std::string &uri) const
 
bool hasError (const std::string &uri, std::string &error) const
 
 RedirectWatcher (std::string redirectUri)
 
bool matches (const std::string &uri) const
 
bool hasError (const std::string &uri, std::string &error) const
 

Detailed Description

FreeRDP: A Remote Desktop Protocol Implementation OAuth2 redirect URI matching for the Qt AAD auth helper

Copyright 2026 David Fort conta.nosp@m.ct@h.nosp@m.arden.nosp@m.ing-.nosp@m.consu.nosp@m.ltin.nosp@m.g.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Watches browser navigation events for a specific OAuth2 redirect_uri. The helper never interprets the "code" query parameter itself (that stays FreeRDP's job) - it only needs to recognize when the browser reached the redirect target and whether the IdP reported an error, then hand the whole URI back verbatim.

FreeRDP: A Remote Desktop Protocol Implementation OAuth2 redirect URI matching for the AAD auth helper

Copyright 2026 David Fort conta.nosp@m.ct@h.nosp@m.arden.nosp@m.ing-.nosp@m.consu.nosp@m.ltin.nosp@m.g.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Watches browser navigation events for a specific OAuth2 redirect_uri. The helper never interprets the "code" query parameter itself (that stays FreeRDP's job) - it only needs to recognize when the browser reached the redirect target and whether the IdP reported an error, then hand the whole URI back verbatim.

Definition at line 28 of file qt-aad-helper/redirect_watcher.hpp.

Constructor & Destructor Documentation

◆ RedirectWatcher()

RedirectWatcher::RedirectWatcher ( std::string  redirectUri)
explicit

Definition at line 74 of file qt-aad-helper/redirect_watcher.cpp.

74 : _redirect_uri(std::move(redirectUri))
75{
76}

Member Function Documentation

◆ hasError()

bool RedirectWatcher::hasError ( const std::string &  uri,
std::string &  error 
) const

Definition at line 90 of file qt-aad-helper/redirect_watcher.cpp.

91{
92 auto args = urlsplit(uri);
93 auto err = args.find("error");
94 if (err == args.end())
95 return false;
96
97 error = err->second;
98 auto suberr = args.find("error_subcode");
99 if (suberr != args.end())
100 error += ": " + suberr->second;
101
102 return true;
103}

◆ matches()

bool RedirectWatcher::matches ( const std::string &  uri) const

Definition at line 78 of file qt-aad-helper/redirect_watcher.cpp.

79{
80 if (_redirect_uri.empty())
81 return false;
82
83 std::string duri = from_url_encoded_str(uri);
84 if (duri.length() < _redirect_uri.length())
85 return false;
86
87 return _strnicmp(duri.c_str(), _redirect_uri.c_str(), _redirect_uri.length()) == 0;
88}

The documentation for this class was generated from the following files: