Skip to content

Commit 4a35c90

Browse files
committed
Several changes:
- Merges from master: - Issue #5694: respond to poll immediately if we still have unacked JavaScript - Added missing users() definition in auth tutorial - override dropEvent in WStandardItemModel - add 'session-thread-pool' wt_config.xml option for #5308 - Added OpenIDConnect feature - WAxisSliderWidget: Set the clip path when drawing the series (issue #5668) - #5663: don't cache senderId for JSignals, change object name after JSignals have been removed - #5658: allow fields containing 'from' in sql select statements - Issue #5648: document that WServer::stop() stops the underlying WIOService - Fixed setObjectName() on WAbstractItemView after construction - WPopupWidget/WPopupMenu: Call bind/unbind function with the right object - Json move semantics and initializer list syntax - Merge pull request emweb#94 from bryongloden/patch-1 Update WMessageResources.C - Wt 4 specific: - Set version back to 4.0.0 - Fixed comments that were changed by overzealous script
1 parent a0fd8f7 commit 4a35c90

File tree

98 files changed

+5116
-1603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+5116
-1603
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ SET(CMAKE_MODULE_PATH
1616
${WT_SOURCE_DIR}/cmake
1717
)
1818

19-
SET(VERSION_SERIES 3)
20-
SET(VERSION_MAJOR 3)
21-
SET(VERSION_MINOR 7)
19+
SET(VERSION_SERIES 4)
20+
SET(VERSION_MAJOR 0)
21+
SET(VERSION_MINOR 0)
2222

2323
SET(WT_SOVERSION 41)
2424
SET(WTEXT_SOVERSION 41)

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ PROJECT_NAME = Wt
3232
# This could be handy for archiving the generated documentation or
3333
# if some version control system is used.
3434

35-
PROJECT_NUMBER = 3.3.7
35+
PROJECT_NUMBER = 4.0.0
3636

3737
# Using the PROJECT_BRIEF tag one can provide an optional one line description
3838
# for a project that appears at the top of each page and should give viewer

doc/tutorial/auth.doc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,11 @@ void Session::configureAuth()
456456
myOAuthServices[i]->generateRedirectEndpoint();
457457
}
458458

459+
Wt::Auth::AbstractUserDatabase& Session::users()
460+
{
461+
return *users_;
462+
}
463+
459464
const Wt::Auth::AuthService& Session::auth()
460465
{
461466
return myAuthService;

examples/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Project related configuration options
55
#---------------------------------------------------------------------------
66
PROJECT_NAME = "Wt examples"
7-
PROJECT_NUMBER = 3.3.7
7+
PROJECT_NUMBER = 4.0.0
88
OUTPUT_DIRECTORY = ../doc/examples
99
CREATE_SUBDIRS = NO
1010
OUTPUT_LANGUAGE = English

examples/feature/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ SUBDIRS(
22
auth1
33
auth2
44
broadcast
5-
client-ssl-auth
5+
client-ssl-auth
66
dbo
77
locale
88
mediaplayer
99
miniwebgl
1010
multiple_servers
1111
oauth
12+
oidc
1213
paypal
1314
scrollvisibility
1415
serverpush

examples/feature/auth1/model/User.C

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
#include <Wt/Auth/Dbo/AuthInfo.h>
1010

1111
DBO_INSTANTIATE_TEMPLATES(User)
12-
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
WT_ADD_EXAMPLE(oidc.wt
2+
Oidc.C
3+
OAuthWidget.C
4+
RegistrationView.C
5+
OAuthAuthorizationEndpoint.C
6+
model/User.C
7+
model/IssuedToken.C
8+
model/OAuthClient.C
9+
model/OidcUserDatabase.C
10+
model/Session.C
11+
model/UserDetailsModel.C
12+
)
13+
14+
TARGET_LINK_LIBRARIES(oidc.wt wtdbo wtdbosqlite3)
15+
16+
INCLUDE_DIRECTORIES(${WT_SOURCE_DIR}/src)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <string>
2+
3+
#include <Wt/WContainerWidget>
4+
#include <Wt/WText>
5+
6+
#include <Wt/Auth/AuthModel>
7+
#include <Wt/Auth/AuthService>
8+
9+
#include "OAuthAuthorizationEndpoint.h"
10+
11+
typedef Wt::Auth::Dbo::AuthInfo<User> AuthInfo;
12+
typedef Wt::Auth::Dbo::UserDatabase<AuthInfo> UserDatabase;
13+
14+
OAuthAuthorizationEndpoint::OAuthAuthorizationEndpoint(const Wt::WEnvironment& env,
15+
std::unique_ptr<Session> session)
16+
: Wt::WApplication(env), session_(std::move(session))
17+
{
18+
messageResourceBundle().use("strings");
19+
messageResourceBundle().use("templates");
20+
21+
auto authwidget = Wt::cpp14::make_unique<OAuthWidget>(*session_);
22+
authwidget->model()->addPasswordAuth(&Session::passwordAuth());
23+
authwidget->setRegistrationEnabled(true);
24+
authwidget->processEnvironment();
25+
26+
process_ = Wt::cpp14::make_unique<Wt::Auth::OAuthAuthorizationEndpointProcess>(
27+
session->login(),
28+
session->users());
29+
process_->authorized().connect(
30+
process_.get(),
31+
&Wt::Auth::OAuthAuthorizationEndpointProcess::authorizeScope);
32+
process_->processEnvironment();
33+
34+
if (process_->validRequest()) {
35+
root()->addWidget(std::move(authwidget));
36+
} else
37+
root()->addWidget(Wt::cpp14::make_unique<Wt::WText>(Wt::utf8("The request was invalid.")));
38+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <string>
2+
3+
#include <Wt/WApplication>
4+
#include <Wt/WEnvironment>
5+
6+
#include <Wt/Auth/OAuthAuthorizationEndpointProcess>
7+
8+
#include "model/OidcUserDatabase.h"
9+
#include "model/User.h"
10+
#include "model/Session.h"
11+
#include "OAuthWidget.h"
12+
13+
typedef Wt::Auth::Dbo::AuthInfo<User> AuthInfo;
14+
typedef Wt::Auth::Dbo::UserDatabase<AuthInfo> UserDatabase;
15+
16+
class OAuthAuthorizationEndpoint : public Wt::WApplication
17+
{
18+
public:
19+
OAuthAuthorizationEndpoint(const Wt::WEnvironment& env,
20+
std::unique_ptr<Session> session);
21+
22+
static Wt::WApplication *createAuthEndpoint(const Wt::WEnvironment& env,
23+
std::string dbPath);
24+
private:
25+
std::unique_ptr<Session> session_;
26+
std::unique_ptr<Wt::Auth::OAuthAuthorizationEndpointProcess> process_;
27+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <Wt/Auth/AuthService>
2+
#include <Wt/Auth/AbstractUserDatabase>
3+
#include <Wt/Auth/AuthWidget>
4+
#include <Wt/Auth/Login>
5+
#include <Wt/Auth/Identity>
6+
#include <Wt/Auth/RegistrationModel>
7+
#include <Wt/WWidget>
8+
#include <Wt/WContainerWidget>
9+
10+
#include "OAuthWidget.h"
11+
#include "RegistrationView.h"
12+
13+
OAuthWidget::OAuthWidget(Session& session)
14+
: Wt::Auth::AuthWidget(Session::auth(),
15+
session.users(),
16+
session.login()),
17+
session_(session)
18+
{
19+
}
20+
21+
std::unique_ptr<Wt::WWidget> OAuthWidget::createRegistrationView(const Wt::Auth::Identity& id)
22+
{
23+
auto w = Wt::cpp14::make_unique<RegistrationView>(session_, this);
24+
auto model = createRegistrationModel();
25+
26+
if (id.isValid())
27+
model->registerIdentified(id);
28+
w->setModel(std::move(model));
29+
return w;
30+
}

0 commit comments

Comments
 (0)