mirror of
https://github.com/wekan/wekan.git
synced 2026-01-02 07:38:49 +01:00
Include to Wekan packages directory contents, so that meteor command would build all directly.
This also simplifies build scripts. Thanks to xet7 !
This commit is contained in:
parent
6117097a93
commit
73e265d8fd
354 changed files with 36977 additions and 106 deletions
68
packages/wekan-oidc/oidc_client.js
Normal file
68
packages/wekan-oidc/oidc_client.js
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
Oidc = {};
|
||||
|
||||
// Request OpenID Connect credentials for the user
|
||||
// @param options {optional}
|
||||
// @param credentialRequestCompleteCallback {Function} Callback function to call on
|
||||
// completion. Takes one argument, credentialToken on success, or Error on
|
||||
// error.
|
||||
Oidc.requestCredential = function (options, credentialRequestCompleteCallback) {
|
||||
// support both (options, callback) and (callback).
|
||||
if (!credentialRequestCompleteCallback && typeof options === 'function') {
|
||||
credentialRequestCompleteCallback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
var config = ServiceConfiguration.configurations.findOne({service: 'oidc'});
|
||||
if (!config) {
|
||||
credentialRequestCompleteCallback && credentialRequestCompleteCallback(
|
||||
new ServiceConfiguration.ConfigError('Service oidc not configured.'));
|
||||
return;
|
||||
}
|
||||
|
||||
var credentialToken = Random.secret();
|
||||
var loginStyle = OAuth._loginStyle('oidc', config, options);
|
||||
var scope = config.requestPermissions || ['openid', 'profile', 'email'];
|
||||
|
||||
// options
|
||||
options = options || {};
|
||||
options.client_id = config.clientId;
|
||||
options.response_type = options.response_type || 'code';
|
||||
options.redirect_uri = OAuth._redirectUri('oidc', config);
|
||||
options.state = OAuth._stateParam(loginStyle, credentialToken, options.redirectUrl);
|
||||
options.scope = scope.join(' ');
|
||||
|
||||
if (config.loginStyle && config.loginStyle == 'popup') {
|
||||
options.display = 'popup';
|
||||
}
|
||||
|
||||
var loginUrl = config.serverUrl + config.authorizationEndpoint;
|
||||
// check if the loginUrl already contains a "?"
|
||||
var first = loginUrl.indexOf('?') === -1;
|
||||
for (var k in options) {
|
||||
if (first) {
|
||||
loginUrl += '?';
|
||||
first = false;
|
||||
}
|
||||
else {
|
||||
loginUrl += '&'
|
||||
}
|
||||
loginUrl += encodeURIComponent(k) + '=' + encodeURIComponent(options[k]);
|
||||
}
|
||||
|
||||
//console.log('XXX: loginURL: ' + loginUrl)
|
||||
|
||||
options.popupOptions = options.popupOptions || {};
|
||||
var popupOptions = {
|
||||
width: options.popupOptions.width || 320,
|
||||
height: options.popupOptions.height || 450
|
||||
};
|
||||
|
||||
OAuth.launchLogin({
|
||||
loginService: 'oidc',
|
||||
loginStyle: loginStyle,
|
||||
loginUrl: loginUrl,
|
||||
credentialRequestCompleteCallback: credentialRequestCompleteCallback,
|
||||
credentialToken: credentialToken,
|
||||
popupOptions: popupOptions,
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue