aboutsummaryrefslogtreecommitdiff
path: root/Src/auth/auth.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/auth/auth.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/auth/auth.h')
-rw-r--r--Src/auth/auth.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/Src/auth/auth.h b/Src/auth/auth.h
new file mode 100644
index 00000000..801f7542
--- /dev/null
+++ b/Src/auth/auth.h
@@ -0,0 +1,46 @@
+#include "api_auth.h"
+#include <api/service/services.h>
+#include "../nu/PtrMap.h"
+#include "XMLString.h"
+#include "../xml/obj_xml.h"
+
+class OpenAuthParser
+{
+public:
+ void RegisterCallbacks(obj_xml *parser);
+ void UnregisterCallbacks(obj_xml *parser);
+ XMLString statusCode, statusText, statusDetailCode;
+ XMLString token;
+ XMLString expire;
+ XMLString session_secret;
+ XMLString context;
+};
+
+
+class Auth : public api_auth
+{
+public:
+ static const char *getServiceName() { return "Authorization API"; }
+ static FOURCC getServiceType() { return WaSvc::UNIQUE; }
+ void Init();
+ void Quit();
+ Auth();
+ int Login(const wchar_t *username, const wchar_t *password, AuthResults *results, ifc_authcallback *callback);
+ int LoginSecurID(const wchar_t *username, const wchar_t *password, const char *context, const wchar_t *securid, AuthResults *results, ifc_authcallback *callback);
+ const char *GetDevID();
+ int SetCredentials(GUID realm, const char *session_key, const char *token, const wchar_t *username, __time64_t expire);
+ int GetCredentials(GUID realm, char *session_key, size_t session_key_len, char *token, size_t token_len, wchar_t *username, size_t username_len, __time64_t *expire);
+ int ClientToWeb(GUID realm, const wchar_t *destination_url, wchar_t *url, size_t urlcch);
+
+ HWND CreateLoginWindow(GUID realm, HWND owner, UINT style);
+ INT_PTR LoginBox(GUID realm, HWND owner, UINT style);
+ int GetUserName(GUID realm, wchar_t *username, size_t username_len);
+
+private:
+ static int SetupLogin(OpenAuthParser &authParser, waServiceFactory *&parserFactory, obj_xml *&parser);
+ static int ParseAuth(const wchar_t *password, OpenAuthParser &authParser, AuthResults *results);
+
+ char *inifile;
+protected:
+ RECVS_DISPATCH;
+};