MantisBase v0.4.9
Loading...
Searching...
No Matches
oauth.h File Reference

OAuth 2.0 / OIDC provider configuration and user login flows. More...

#include <string>
#include <optional>
#include <nlohmann/json.hpp>
#include "mantisbase/core/types.h"
Include dependency graph for oauth.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mb::MbOAuthMgr
 OAuth provider registry, entity enablement, and login/link flows. More...

Namespaces

namespace  mb

Detailed Description

OAuth 2.0 / OIDC provider configuration and user login flows.

OAuth is configured per auth-type entity. Preset providers (Google, GitHub, Discord, Microsoft) are seeded at startup; admins supply client_id and client_secret before enabling them for an entity.

Access from C++ through MbAuth::oauth() on your owned MantisBase instance.

auto app = MantisBase::create();
auto& oauth = app->auth().oauth();
// Admin: register or update a provider, then enable it for an entity
oauth.addProvider({{"name", "google"}, {"client_id", "..."}, {"client_secret", "..."}});
oauth.enableProviderForEntity("users", provider_id);
// User-facing authorize URL (PKCE)
auto url = oauth.buildAuthorizeUrl("users", "google", redirect_uri);