diff --git a/modules/Makefile.am b/modules/Makefile.am index 8a90cdd4e..6e673fd3a 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -139,6 +139,7 @@ client_module_LTLIBRARIES += client/client_rooms.la # client_client_user_la_SOURCES = \ + client/user/openid.cc \ client/user/filter.cc \ client/user/account_data.cc \ client/user/user.cc \ diff --git a/modules/client/user/openid.cc b/modules/client/user/openid.cc new file mode 100644 index 000000000..72298cfc5 --- /dev/null +++ b/modules/client/user/openid.cc @@ -0,0 +1,58 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2018 Jason Volk +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice is present in all copies. The +// full license for this software is available in the LICENSE file. + +#include "user.h" + +using namespace ircd; + +static resource::response +post__openid__request_token(client &client, + const resource::request &request, + const m::user::id &user_id); + +resource::response +post__openid(client &client, + const resource::request &request, + const m::user::id &user_id) +{ + if(user_id != request.user_id) + throw m::FORBIDDEN + { + "Trying to post openid for `%s' but you are `%s'", + user_id, + request.user_id + }; + + // request.parv[0] = + // request.parv[1] = "openid" + const string_view &cmd + { + request.parv[2] + }; + + if(cmd == "request_token") + return post__openid__request_token(client, request, user_id); + + throw m::NOT_FOUND + { + "/user/openid command not found" + }; +} + +resource::response +post__openid__request_token(client &client, + const resource::request &request, + const m::user::id &user_id) +{ + return resource::response + { + client, http::NOT_FOUND + }; +} diff --git a/modules/client/user/user.cc b/modules/client/user/user.cc index 31487710b..35119c433 100644 --- a/modules/client/user/user.cc +++ b/modules/client/user/user.cc @@ -87,6 +87,9 @@ post_user(client &client, resource::request &request) if(cmd == "filter") return post__filter(client, request, user_id); + if(cmd == "openid") + return post__openid(client, request, user_id); + throw m::NOT_FOUND { "/user command not found" diff --git a/modules/client/user/user.h b/modules/client/user/user.h index df40fa6c3..655bb169c 100644 --- a/modules/client/user/user.h +++ b/modules/client/user/user.h @@ -34,3 +34,13 @@ ircd::resource::response put__account_data(ircd::client &client, const ircd::resource::request &request, const ircd::m::user::id &user_id); + +/////////////////////////////////////////////////////////////////////////////// +// +// openid.cc +// + +ircd::resource::response +post__openid(ircd::client &client, + const ircd::resource::request &request, + const ircd::m::user::id &user_id);