Connect Cocalc by OAuth with MediaWiki (MediaWiki4IntraNet)

From Wiki4Intranet
Jump to: navigation, search
(Install Cocalc)
(Install Cocalc)
Line 56: Line 56:
 
* Go to PostgresQL database «SMC», table «passport_settings»
 
* Go to PostgresQL database «SMC», table «passport_settings»
 
* add row with «oauth1» key, and value like this
 
* add row with «oauth1» key, and value like this
 +
 +
 +
<source lang="json">
 +
{
 +
    "icon": "https://yourwiki.site/img_auth.php/6/6f/ThisWikiLogo.png",
 +
    "type": "oauth1",
 +
    "scope": [
 +
        "id",
 +
        "email"
 +
    ],
 +
    "public": true,
 +
    "display": "YourWikiLogin",
 +
    "login_info": {
 +
        "emails": "emails[0].value"
 +
    },
 +
    "consumerKey": "xxxxxxxxxxxxx",
 +
    "userinfoURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Fidentify",
 +
    "accessTokenURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Ftoken",
 +
    "consumerSecret": "yyyyyyyyyyyyy",
 +
    "requestTokenURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Finitiate",
 +
    "userAuthorizationURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Fauthorize"
 +
}
 +
</source>

Revision as of 02:19, 8 April 2022

The Idea

CoCalc (my fork) is great service for scientific realtime collaboration (jupyter notebooks, latex editing, PDF articles sharing). But it is not suitable for creating Team Portal/Dashboard, and Team Knowledge Base. Lot of loosely connected projects, impossibility of consistenly linked/renamed pages, … So better to have MediaWiki (MediaWiki4IntraNet) + CoCalc with authorization on the MediaWiki. Additionaly to Content Features, this binging get interesting possibilities to Team Authorization. For example, «extensions/LdapAuthentication» allows MediaWiki authenticate by LDAP, but is is not possible without radical patching, add LDAP Auth to Cocalc.

So, how to do it.

For MediaWiki4IntraNet, install REL1_26 branch of our fork https://github.com/mediawiki4intranet/mediawiki-extensions-OAuth (branch REL1_26 unusable and need patch).

Add this to LocalSettings:

$wgGroupPermissions['user']['mwoauthproposeconsumer'] = true;
$wgGroupPermissions['user']['mwoauthupdateownconsumer'] = true;
$wgGroupPermissions['user']['mwoauthmanageconsumer'] = true;
$wgGroupPermissions['user']['mwoauthsuppress'] = true;
$wgGroupPermissions['user']['mwoauthviewsuppressed'] = true;
$wgGroupPermissions['user']['mwoauthviewprivate'] = true;
$wgGroupPermissions['user']['mwoauthmanagemygrants'] = true;

Register new client

… /Special:OAuthConsumerRegistration/propose

Connect Cocalc by OAuth with MediaWiki (MediaWiki4IntraNet) 2022-03-29 18-24-23 image0.png
  • Record consumer key and secret «You have been assigned a consumer token of xxxx and a secret token of yyyy. Please record these for future reference».

… /Special:OAuthConsumerRegistration/list

Connect Cocalc by OAuth with MediaWiki (MediaWiki4IntraNet) 2022-03-29 21-05-59 image0.png


… /Special:OAuthManageConsumers

Connect Cocalc by OAuth with MediaWiki (MediaWiki4IntraNet) 2022-03-29 21-08-04 image0.png

… /Special:OAuthManageConsumers/proposed

Connect Cocalc by OAuth with MediaWiki (MediaWiki4IntraNet) 2022-03-29 21-09-59 image0.png

… Find appropriate row in table «oauth_register», column «oarc_grants» insert in cell rights:

["authonly", "authonlyprivate"]
Todo
Why where is not frontend interface for doing so? May be need patch.


Install Cocalc

  • https://github.com/belonesox/cocalc branch «belonesox-stable» or «belonesox-oauth1».
  • Go to PostgresQL database «SMC», table «passport_settings»
  • add row with «oauth1» key, and value like this


Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, aimms, algol68, apache, applescript, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, caddcl, cadlisp, cfdg, cfm, chaiscript, chapel, cil, clojure, cmake, cobol, coffeescript, cpp, csharp, css, cuesheet, d, dart, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, ezt, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, ispfpanel, j, java, java5, javascript, jcl, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nginx, nimrod, nsis, oberon2, objc, objeck, ocaml, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, pic16, pike, pixelbender, pli, plsql, postgresql, postscript, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, qml, racket, rails, rbs, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, rust, sas, scala, scheme, scilab, scl, sdlbasic, smalltalk, smarty, spark, sparql, sql, standardml, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vbscript, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xpp, yaml, z80, zxbasic


{
    "icon": "https://yourwiki.site/img_auth.php/6/6f/ThisWikiLogo.png",
    "type": "oauth1",
    "scope": [
        "id",
        "email"
    ],
    "public": true,
    "display": "YourWikiLogin",
    "login_info": {
        "emails": "emails[0].value"
    },
    "consumerKey": "xxxxxxxxxxxxx",
    "userinfoURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Fidentify",
    "accessTokenURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Ftoken",
    "consumerSecret": "yyyyyyyyyyyyy",
    "requestTokenURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Finitiate",
    "userAuthorizationURL": "https://yourwiki.site/index.php?title=Special%3AOAuth%2Fauthorize"
}