mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 07:23:53 +01:00
modules/client/user: Stub openid/ openid/request_token.
This commit is contained in:
parent
98ceb154c3
commit
754a9366fb
4 changed files with 72 additions and 0 deletions
|
@ -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 \
|
||||
|
|
58
modules/client/user/openid.cc
Normal file
58
modules/client/user/openid.cc
Normal file
|
@ -0,0 +1,58 @@
|
|||
// Matrix Construct
|
||||
//
|
||||
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
||||
//
|
||||
// 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] = <user_id>
|
||||
// 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
|
||||
};
|
||||
}
|
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue