Files
common/CEF4Delphi/win32/hpps/uCEFOAuth2Helper.hpp
T
2026-06-12 23:18:12 +08:00

126 lines
5.4 KiB
C++

// CodeGear C++Builder
// Copyright (c) 1995, 2025 by Embarcadero Technologies, Inc.
// All rights reserved
// (DO NOT EDIT: machine generated header) 'uCEFOAuth2Helper.pas' rev: 37.00 (Windows)
#ifndef uCEFOAuth2HelperHPP
#define uCEFOAuth2HelperHPP
#pragma delphiheader begin
#pragma option push
#if defined(__BORLANDC__) && !defined(__clang__)
#pragma option -w- // All warnings off
#pragma option -Vx // Zero-length empty class member
#endif
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <Winapi.Windows.hpp>
#include <System.Classes.hpp>
#include <System.UITypes.hpp>
#include <System.SysUtils.hpp>
#include <uCEFInterfaces.hpp>
#include <uCEFTypes.hpp>
//-- user supplied -----------------------------------------------------------
namespace Ucefoauth2helper
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TCEFOAuth2Helper;
//-- type declarations -------------------------------------------------------
enum DECLSPEC_DENUM TOAuthChallengeMethod : unsigned char { cmPlain, cmSHA256 };
#pragma pack(push,4)
class PASCALIMPLEMENTATION TCEFOAuth2Helper : public System::TObject
{
typedef System::TObject inherited;
protected:
Uceftypes::ustring FRedirectHost;
int FRedirectPort;
Uceftypes::ustring FAuthEndpoint;
Uceftypes::ustring FTokenEndpoint;
Uceftypes::ustring FClientID;
Uceftypes::ustring FClientSecret;
Uceftypes::ustring FAuthCode;
Uceftypes::ustring FError;
Uceftypes::ustring FErrorDescription;
Uceftypes::ustring FCodeVerifier;
Uceftypes::ustring FCodeChallenge;
Uceftypes::ustring FScope;
Uceftypes::ustring FAccessToken;
Uceftypes::ustring FIDToken;
Uceftypes::ustring FState;
Uceftypes::ustring FIncState;
Uceftypes::ustring FRefreshToken;
int FTokenExpiry;
Uceftypes::ustring FTokenType;
Uceftypes::ustring FLoginHint;
TOAuthChallengeMethod FChallengeMethod;
virtual Uceftypes::ustring __fastcall GetRedirectURI();
virtual Uceftypes::ustring __fastcall GetAuthCodeURI();
virtual Uceftypes::ustring __fastcall GetRefreshParams();
virtual Uceftypes::ustring __fastcall GetTokeExchangeParams();
virtual bool __fastcall GetValidState();
virtual void __fastcall GenerateRandomCodeChallenge();
virtual void __fastcall GenerateRandomState();
Uceftypes::ustring __fastcall GenerateRandomString(unsigned aLength);
void __fastcall ParseQueryPair(const Uceftypes::ustring aPair);
Uceftypes::ustring __fastcall ReadJSONString(const Ucefinterfaces::_di_ICefDictionaryValue aDictionary, const Uceftypes::ustring aKey);
int __fastcall ReadJSONInteger(const Ucefinterfaces::_di_ICefDictionaryValue aDictionary, const Uceftypes::ustring aKey);
Uceftypes::TCefCustomByteArray __fastcall CalculateSHA256Hash(const Uceftypes::ustring aString);
public:
__fastcall TCEFOAuth2Helper();
virtual void __fastcall Initialize();
virtual bool __fastcall ParseTokenExchangeResponse(const Uceftypes::ustring aResponse);
virtual bool __fastcall ParseRefreshTokenResponse(const Uceftypes::ustring aResponse);
virtual bool __fastcall ParseCodeRequestResponse(const Uceftypes::ustring aURL);
__property Uceftypes::ustring AuthEndpoint = {read=FAuthEndpoint, write=FAuthEndpoint};
__property Uceftypes::ustring TokenEndpoint = {read=FTokenEndpoint, write=FTokenEndpoint};
__property Uceftypes::ustring ClientID = {read=FClientID, write=FClientID};
__property Uceftypes::ustring ClientSecret = {read=FClientSecret, write=FClientSecret};
__property Uceftypes::ustring RedirectHost = {read=FRedirectHost, write=FRedirectHost};
__property int RedirectPort = {read=FRedirectPort, write=FRedirectPort, nodefault};
__property TOAuthChallengeMethod ChallengeMethod = {read=FChallengeMethod, write=FChallengeMethod, nodefault};
__property Uceftypes::ustring Scope = {read=FScope, write=FScope};
__property Uceftypes::ustring Error = {read=FError};
__property Uceftypes::ustring ErrorDescription = {read=FErrorDescription};
__property Uceftypes::ustring AccessToken = {read=FAccessToken};
__property Uceftypes::ustring IDToken = {read=FIDToken};
__property Uceftypes::ustring RefreshToken = {read=FRefreshToken};
__property int TokenExpiry = {read=FTokenExpiry, nodefault};
__property Uceftypes::ustring TokenType = {read=FTokenType};
__property Uceftypes::ustring CodeVerifier = {read=FCodeVerifier};
__property Uceftypes::ustring CodeChallenge = {read=FCodeChallenge};
__property Uceftypes::ustring RedirectURI = {read=GetRedirectURI};
__property Uceftypes::ustring AuthCodeURI = {read=GetAuthCodeURI};
__property Uceftypes::ustring TokeExchangeParams = {read=GetTokeExchangeParams};
__property Uceftypes::ustring RefreshParams = {read=GetRefreshParams};
__property bool ValidState = {read=GetValidState, nodefault};
public:
/* TObject.Destroy */ inline __fastcall virtual ~TCEFOAuth2Helper() { }
};
#pragma pack(pop)
//-- var, const, procedure ---------------------------------------------------
#define DEFAULT_REDIRECT_IPV4_HOST L"127.0.0.1"
#define DEFAULT_REDIRECT_IPV6_HOST L"[::1]"
static _DELPHI_CONST System::Word DEFAULT_REDIRECT_PORT = System::Word(0xc350);
#define GOOGLE_DISCOVERY_DOCUMENT L"https://accounts.google.com/.well-known/openid-configurati"\
L"on"
} /* namespace Ucefoauth2helper */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_UCEFOAUTH2HELPER)
using namespace Ucefoauth2helper;
#endif
#pragma pack(pop)
#pragma option pop
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // uCEFOAuth2HelperHPP