init
This commit is contained in:
115
nv/html/nv-nopdf/styles/packages/mxab_keycloak-oauth.js
Normal file
115
nv/html/nv-nopdf/styles/packages/mxab_keycloak-oauth.js
Normal file
@@ -0,0 +1,115 @@
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// This is a generated file. You can view the original //
|
||||
// source in your browser if your browser supports source maps. //
|
||||
// Source maps are supported by all recent versions of Chrome, Safari, //
|
||||
// and Firefox, and by Internet Explorer 11. //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
(function () {
|
||||
|
||||
/* Imports */
|
||||
var Meteor = Package.meteor.Meteor;
|
||||
var global = Package.meteor.global;
|
||||
var meteorEnv = Package.meteor.meteorEnv;
|
||||
var OAuth = Package.oauth.OAuth;
|
||||
var Oauth = Package.oauth.Oauth;
|
||||
var Random = Package.random.Random;
|
||||
var ServiceConfiguration = Package['service-configuration'].ServiceConfiguration;
|
||||
var meteorInstall = Package.modules.meteorInstall;
|
||||
var meteorBabelHelpers = Package['babel-runtime'].meteorBabelHelpers;
|
||||
var Promise = Package.promise.Promise;
|
||||
var Symbol = Package['ecmascript-runtime-client'].Symbol;
|
||||
var Map = Package['ecmascript-runtime-client'].Map;
|
||||
var Set = Package['ecmascript-runtime-client'].Set;
|
||||
|
||||
/* Package-scope variables */
|
||||
var MeteorKeycloak;
|
||||
|
||||
var require = meteorInstall({"node_modules":{"meteor":{"mxab:keycloak-oauth":{"keycloak-client.js":function(require,exports,module){
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// packages/mxab_keycloak-oauth/keycloak-client.js //
|
||||
// //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
var Random;
|
||||
module.watch(require("meteor/random"), {
|
||||
Random: function (v) {
|
||||
Random = v;
|
||||
}
|
||||
}, 0);
|
||||
var ServiceConfiguration;
|
||||
module.watch(require("meteor/service-configuration"), {
|
||||
ServiceConfiguration: function (v) {
|
||||
ServiceConfiguration = v;
|
||||
}
|
||||
}, 1);
|
||||
MeteorKeycloak = {}; // Request MeteorKeycloak 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.
|
||||
|
||||
MeteorKeycloak.requestCredential = function (options, credentialRequestCompleteCallback) {
|
||||
// support both (options, callback) and (callback).
|
||||
if (!credentialRequestCompleteCallback && typeof options === 'function') {
|
||||
credentialRequestCompleteCallback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
var serviceName = 'keycloak';
|
||||
var config = ServiceConfiguration.configurations.findOne({
|
||||
service: serviceName
|
||||
});
|
||||
|
||||
if (!config) {
|
||||
credentialRequestCompleteCallback && credentialRequestCompleteCallback(new ServiceConfiguration.ConfigError());
|
||||
return;
|
||||
}
|
||||
|
||||
var authServerUrl = config["auth-server-url"];
|
||||
var realm = config['realm'];
|
||||
var clientId = config["resource"];
|
||||
var credentialToken = Random.secret();
|
||||
var loginStyle = config.loginStyle || "redirect";
|
||||
var realmUrl = authServerUrl + "/realms/" + realm;
|
||||
|
||||
var redirectUri = OAuth._redirectUri(serviceName, config);
|
||||
|
||||
var state = OAuth._stateParam(loginStyle, credentialToken, options && options.redirectUrl);
|
||||
|
||||
var loginUrl = realmUrl + '/protocol/openid-connect/auth' + '?client_id=' + encodeURIComponent(clientId) + '&redirect_uri=' + redirectUri + '&state=' + state + '&nonce=' + encodeURIComponent(Random.secret()) + '&response_mode=' + encodeURIComponent('query') + '&response_type=' + encodeURIComponent('code') + '&scope=' + encodeURIComponent("oidc"); // Handle authentication type (e.g. for force login you need auth_type: "reauthenticate")
|
||||
|
||||
if (options && options.auth_type) {
|
||||
loginUrl += "&auth_type=" + encodeURIComponent(options.auth_type);
|
||||
}
|
||||
|
||||
OAuth.launchLogin({
|
||||
loginService: serviceName,
|
||||
loginStyle: loginStyle,
|
||||
loginUrl: loginUrl,
|
||||
credentialRequestCompleteCallback: credentialRequestCompleteCallback,
|
||||
credentialToken: credentialToken
|
||||
});
|
||||
};
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}}}}},{
|
||||
"extensions": [
|
||||
".js",
|
||||
".json"
|
||||
]
|
||||
});
|
||||
require("/node_modules/meteor/mxab:keycloak-oauth/keycloak-client.js");
|
||||
|
||||
/* Exports */
|
||||
Package._define("mxab:keycloak-oauth", {
|
||||
MeteorKeycloak: MeteorKeycloak
|
||||
});
|
||||
|
||||
})();
|
||||
Reference in New Issue
Block a user