Loading src/auth.cpp +28 −0 Changes for src/auth.cpp: 28 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -61,6 +61,34 @@ blogi::Auth::Auth(std::vector<std::unique_ptr<dbpp::Database>> &pcon,const blogi << "password character varying(255)" << ");"; _dbconn[0]->exec(sql,res); // Auto-create "Blogi: Allow Login" GPO if it doesn't exist yet const uuid::uuid loginGpoId("e7d3b8b3-4825-11f0-ae2b-3cecefce9cb6"); for(size_t i = 0; i < _config.getAuthSourceCount(); ++i){ const AuthSource &src = _config.getAuthSource(i); try { authdb::client::ClientConnection authcon; authcon.setUrl(src.url); authcon.setClientName(src.clientName); authcon.setClientSecret(src.clientSecret); authdb::client::Client clt(authcon); if(!clt.ClientAuth()) continue; if(!clt.GPOexits(loginGpoId)){ std::vector<std::string> members; clt.GPOadd(loginGpoId, "Blogi: Allow Login", "Allow Login to webinterface", true, members); std::cout << "Created GPO 'Blogi: Allow Login' on auth source: " << src.domain << std::endl; } } catch (std::exception &e) { std::cerr << "Warning: could not ensure login GPO on auth source '" << src.domain << "': " << e.what() << std::endl; } } } blogi::Auth::~Auth(){ Loading Loading
src/auth.cpp +28 −0 Changes for src/auth.cpp: 28 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -61,6 +61,34 @@ blogi::Auth::Auth(std::vector<std::unique_ptr<dbpp::Database>> &pcon,const blogi << "password character varying(255)" << ");"; _dbconn[0]->exec(sql,res); // Auto-create "Blogi: Allow Login" GPO if it doesn't exist yet const uuid::uuid loginGpoId("e7d3b8b3-4825-11f0-ae2b-3cecefce9cb6"); for(size_t i = 0; i < _config.getAuthSourceCount(); ++i){ const AuthSource &src = _config.getAuthSource(i); try { authdb::client::ClientConnection authcon; authcon.setUrl(src.url); authcon.setClientName(src.clientName); authcon.setClientSecret(src.clientSecret); authdb::client::Client clt(authcon); if(!clt.ClientAuth()) continue; if(!clt.GPOexits(loginGpoId)){ std::vector<std::string> members; clt.GPOadd(loginGpoId, "Blogi: Allow Login", "Allow Login to webinterface", true, members); std::cout << "Created GPO 'Blogi: Allow Login' on auth source: " << src.domain << std::endl; } } catch (std::exception &e) { std::cerr << "Warning: could not ensure login GPO on auth source '" << src.domain << "': " << e.what() << std::endl; } } } blogi::Auth::~Auth(){ Loading