From 4ce91213eedf7c6b9eee1339290fbff1818989bd Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 16 May 2017 17:33:41 +0100 Subject: [PATCH 1/5] Enabling authentication with OpenId connect --- conf/shiro.ini.template | 25 +++++++++++++++++++ pom.xml | 21 +++++++++++++++- zeppelin-server/pom.xml | 23 ++++++++++++++++- zeppelin-web/src/app/app.js | 19 +++++++++++++- .../src/components/navbar/navbar.html | 2 +- 5 files changed, 86 insertions(+), 4 deletions(-) diff --git a/conf/shiro.ini.template b/conf/shiro.ini.template index 0a3187a6450..8afe1ee181e 100644 --- a/conf/shiro.ini.template +++ b/conf/shiro.ini.template @@ -55,6 +55,30 @@ user3 = password4, role2 #zeppelinHubRealm.zeppelinhubUrl = https://www.zeppelinhub.com #securityManager.realms = $zeppelinHubRealm +### A sample for configuring OIDC Pac4J managed login(i.e. Keycloak) +#oidcConfig = org.pac4j.oidc.config.OidcConfiguration +#oidcConfig.discoveryURI = /realms//.well-known/openid-configuration +#oidcConfig.clientId = +#oidcConfig.secret = +#oidcConfig.clientAuthenticationMethodAsString = client_secret_basic +#oidcClient = org.pac4j.oidc.client.OidcClient +#oidcClient.configuration = $oidcConfig +#clients = org.pac4j.core.client.Clients +#clients.callbackUrl = http://:8080/api/callback +#clients.clients = $oidcClient +#requireRoleAdmin = org.pac4j.core.authorization.authorizer.RequireAnyRoleAuthorizer +#requireRoleAdmin.elements = +#config = org.pac4j.core.config.Config +#config.clients = $clients +#config.authorizers = admin:$requireRoleAdmin +#pac4jRealm = io.buji.pac4j.realm.Pac4jRealm +#pac4jSubjectFactory = io.buji.pac4j.subject.Pac4jSubjectFactory +#securityManager.subjectFactory = $pac4jSubjectFactory +#oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter +#oidcSecurityFilter.config = $config +#oidcSecurityFilter.clients = oidcClient + + sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager ### If caching of user is required then uncomment below lines @@ -82,5 +106,6 @@ admin = * #/api/interpreter/** = authc, roles[admin] #/api/configurations/** = authc, roles[admin] #/api/credential/** = authc, roles[admin] +#/api/callback = callbackFilter #/** = anon /** = authc diff --git a/pom.xml b/pom.xml index 3bede629380..e6863f6f8a2 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,9 @@ 2.4 3.2.1 1.1.1 - 1.2.3 + 1.3.2 + 1.9.8 + 2.2.0 4.12 @@ -252,6 +254,23 @@ ${shiro.version} + + + io.buji + buji-pac4j + ${buji.version} + + + org.pac4j + pac4j-core + ${pac4j.version} + + + org.pac4j + pac4j-oidc + ${pac4j.version} + + junit diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml index ac5cb2b1256..6a2db9087ad 100644 --- a/zeppelin-server/pom.xml +++ b/zeppelin-server/pom.xml @@ -113,6 +113,27 @@ shiro-web + + io.buji + buji-pac4j + + + + org.pac4j + pac4j-core + + + + org.pac4j + pac4j-oidc + + + org.apache.commons + commons-lang3 + + + + org.kohsuke libpam4j @@ -487,7 +508,7 @@ - + using-source-tree diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index fc5ffbdbe09..4822472f4c1 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -129,6 +129,7 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) // handel logout on API failure .config(function ($httpProvider, $provide) { + $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest' $provide.factory('httpInterceptor', function ($q, $rootScope) { return { 'responseError': function (rejection) { @@ -146,6 +147,7 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) }) .constant('TRASH_FOLDER_ID', '~Trash') + function auth () { let $http = angular.injector(['ng']).get('$http') let baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv') @@ -158,12 +160,27 @@ function auth () { }, crossDomain: true }) - return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function (response) { + var config = {headers: { + "X-Requested-With": "XMLHttpRequest" + } + } + return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket', config).then(function (response) { zeppelinWebApp.run(function ($rootScope) { $rootScope.ticket = angular.fromJson(response.data).body + + $rootScope.ticket.screenUsername = $rootScope.ticket.principal + if ($rootScope.ticket.principal.startsWith("#Pac4j")) { + let re = ", name=(.*?)," + $rootScope.ticket.screenUsername = $rootScope.ticket.principal.match(re)[1] + } }) }, function (errorResponse) { // Handle error case + var redirect = errorResponse.headers('Location') + if (errorResponse.status == 401 && redirect != undefined) { + //handle page redirect + window.location.href = redirect + } }) } diff --git a/zeppelin-web/src/components/navbar/navbar.html b/zeppelin-web/src/components/navbar/navbar.html index 2cae91b6803..8c6749288ee 100644 --- a/zeppelin-web/src/components/navbar/navbar.html +++ b/zeppelin-web/src/components/navbar/navbar.html @@ -86,7 +86,7 @@ From 03bbe30b5707580580e2ee5c27126e7541220ff9 Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 30 May 2017 07:32:02 +0100 Subject: [PATCH 2/5] updates --- conf/shiro.ini.template | 3 + docs/security/shiroauthentication.md | 39 +++++- licenses/LICENSE-pac4j-1.9.8 | 201 +++++++++++++++++++++++++++ pom.xml | 17 --- zeppelin-server/pom.xml | 9 ++ 5 files changed, 249 insertions(+), 20 deletions(-) create mode 100644 licenses/LICENSE-pac4j-1.9.8 diff --git a/conf/shiro.ini.template b/conf/shiro.ini.template index 8afe1ee181e..332c9231966 100644 --- a/conf/shiro.ini.template +++ b/conf/shiro.ini.template @@ -77,6 +77,9 @@ user3 = password4, role2 #oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter #oidcSecurityFilter.config = $config #oidcSecurityFilter.clients = oidcClient +#callbackFilter = io.buji.pac4j.filter.CallbackFilter +#callbackFilter.defaultUrl = http://:8080 +#callbackFilter.config = $config sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager diff --git a/docs/security/shiroauthentication.md b/docs/security/shiroauthentication.md index 348c43889a2..5de1707d36b 100644 --- a/docs/security/shiroauthentication.md +++ b/docs/security/shiroauthentication.md @@ -138,12 +138,12 @@ ldapRealm.contextFactory.authenticationMechanism = simple ``` ### PAM -[PAM](https://en.wikipedia.org/wiki/Pluggable_authentication_module) authentication support allows the reuse of existing authentication +[PAM](https://en.wikipedia.org/wiki/Pluggable_authentication_module) authentication support allows the reuse of existing authentication moduls on the host where Zeppelin is running. On a typical system modules are configured per service for example sshd, passwd, etc. under `/etc/pam.d/`. You can either reuse one of these services or create your own for Zeppelin. Activiting PAM authentication requires two parameters: 1. realm: The Shiro realm being used 2. service: The service configured under `/etc/pam.d/` to be used. The name here needs to be the same as the file name under `/etc/pam.d/` - + ``` [main] pamRealm=org.apache.zeppelin.realm.PamRealm @@ -165,6 +165,40 @@ securityManager.realms = $zeppelinHubRealm > Note: ZeppelinHub is not releated to Apache Zeppelin project. +### OpenID Connect +OpenID Connect enable you to integrate Zeppelin login with several providers(Google, AzureAD, Okta, IdentityServer3 (and 4), MitreID, Keycloak...). + +Support is provided by the use of: [Pac4j-oidc](http://www.pac4j.org/docs/clients/openid-connect.html) and [Buji-pac4j](https://github.com/bujiio/buji-pac4j). + +Specific configuration is strictly related to the provider, you need to configure the oidcClient to redirect you to the provider login page, handle the redirection back through the callback filter and add a SecurityFilter to check validity of the token. +More configuration parameters are available through [Buji-pac4j](https://github.com/bujiio/buji-pac4j) documentation. + +``` +### A sample for configuring Open ID Connect integration +oidcConfig = org.pac4j.oidc.config.OidcConfiguration +oidcConfig.discoveryURI = /realms//.well-known/openid-configuration +oidcConfig.clientId = +oidcConfig.secret = +oidcConfig.clientAuthenticationMethodAsString = client_secret_basic +oidcClient = org.pac4j.oidc.client.OidcClient +oidcClient.configuration = $oidcConfig +oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter +oidcSecurityFilter.config = $config +oidcSecurityFilter.clients = oidcClient + +clients = org.pac4j.core.client.Clients +clients.callbackUrl = http://:8080/api/callback +clients.clients = $oidcClient + +callbackFilter = io.buji.pac4j.filter.CallbackFilter +callbackFilter.defaultUrl = http://:8080 +callbackFilter.config = $config + +##add this route to urls +[urls] +/api/callback = callbackFilter +``` + ## Secure your Zeppelin information (optional) By default, anyone who defined in `[users]` can share **Interpreter Setting**, **Credential** and **Configuration** information in Apache Zeppelin. Sometimes you might want to hide these information for your use case. @@ -188,4 +222,3 @@ If you want to grant this permission to other users, you can change **roles[ ]** ## Other authentication methods - [HTTP Basic Authentication using NGINX](./authentication.html) - diff --git a/licenses/LICENSE-pac4j-1.9.8 b/licenses/LICENSE-pac4j-1.9.8 new file mode 100644 index 00000000000..f49a4e16e68 --- /dev/null +++ b/licenses/LICENSE-pac4j-1.9.8 @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/pom.xml b/pom.xml index e6863f6f8a2..a6f5442dd3b 100644 --- a/pom.xml +++ b/pom.xml @@ -254,23 +254,6 @@ ${shiro.version} - - - io.buji - buji-pac4j - ${buji.version} - - - org.pac4j - pac4j-core - ${pac4j.version} - - - org.pac4j - pac4j-oidc - ${pac4j.version} - - junit diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml index 6a2db9087ad..017d8ed880e 100644 --- a/zeppelin-server/pom.xml +++ b/zeppelin-server/pom.xml @@ -116,16 +116,25 @@ io.buji buji-pac4j + ${buji.version} + + + org.pac4j + pac4j-core + + org.pac4j pac4j-core + ${pac4j.version} org.pac4j pac4j-oidc + ${pac4j.version} org.apache.commons From 545686dced6999bda7b8b6c21761874c9453cbd1 Mon Sep 17 00:00:00 2001 From: andrea Date: Tue, 30 May 2017 13:23:24 +0100 Subject: [PATCH 3/5] fix username after direct login --- zeppelin-web/src/components/navbar/navbar.controller.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zeppelin-web/src/components/navbar/navbar.controller.js b/zeppelin-web/src/components/navbar/navbar.controller.js index 8bf3d195bcf..03976d6e08a 100644 --- a/zeppelin-web/src/components/navbar/navbar.controller.js +++ b/zeppelin-web/src/components/navbar/navbar.controller.js @@ -95,6 +95,7 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location, $http.post(logoutURL).error(function () { $rootScope.userName = '' $rootScope.ticket.principal = '' + $rootScope.ticket.screenUsername = '' $rootScope.ticket.ticket = '' $rootScope.ticket.roles = '' BootstrapDialog.show({ @@ -131,6 +132,7 @@ function NavCtrl ($scope, $rootScope, $http, $routeParams, $location, }) $scope.$on('loginSuccess', function (event, param) { + $rootScope.ticket.screenUsername = $rootScope.ticket.principal listConfigurations() loadNotes() getHomeNote() From 7ec8cddbe1f8162eb0bde7e2dbf8c76e2a4656bf Mon Sep 17 00:00:00 2001 From: andrea Date: Thu, 1 Jun 2017 14:07:55 +0100 Subject: [PATCH 4/5] reverted to a minimum --- conf/shiro.ini.template | 28 --- docs/security/shiroauthentication.md | 34 --- licenses/LICENSE-pac4j-1.9.8 | 201 ------------------ pom.xml | 2 - zeppelin-distribution/src/bin_license/LICENSE | 4 +- zeppelin-server/pom.xml | 31 --- 6 files changed, 2 insertions(+), 298 deletions(-) delete mode 100644 licenses/LICENSE-pac4j-1.9.8 diff --git a/conf/shiro.ini.template b/conf/shiro.ini.template index 332c9231966..0a3187a6450 100644 --- a/conf/shiro.ini.template +++ b/conf/shiro.ini.template @@ -55,33 +55,6 @@ user3 = password4, role2 #zeppelinHubRealm.zeppelinhubUrl = https://www.zeppelinhub.com #securityManager.realms = $zeppelinHubRealm -### A sample for configuring OIDC Pac4J managed login(i.e. Keycloak) -#oidcConfig = org.pac4j.oidc.config.OidcConfiguration -#oidcConfig.discoveryURI = /realms//.well-known/openid-configuration -#oidcConfig.clientId = -#oidcConfig.secret = -#oidcConfig.clientAuthenticationMethodAsString = client_secret_basic -#oidcClient = org.pac4j.oidc.client.OidcClient -#oidcClient.configuration = $oidcConfig -#clients = org.pac4j.core.client.Clients -#clients.callbackUrl = http://:8080/api/callback -#clients.clients = $oidcClient -#requireRoleAdmin = org.pac4j.core.authorization.authorizer.RequireAnyRoleAuthorizer -#requireRoleAdmin.elements = -#config = org.pac4j.core.config.Config -#config.clients = $clients -#config.authorizers = admin:$requireRoleAdmin -#pac4jRealm = io.buji.pac4j.realm.Pac4jRealm -#pac4jSubjectFactory = io.buji.pac4j.subject.Pac4jSubjectFactory -#securityManager.subjectFactory = $pac4jSubjectFactory -#oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter -#oidcSecurityFilter.config = $config -#oidcSecurityFilter.clients = oidcClient -#callbackFilter = io.buji.pac4j.filter.CallbackFilter -#callbackFilter.defaultUrl = http://:8080 -#callbackFilter.config = $config - - sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager ### If caching of user is required then uncomment below lines @@ -109,6 +82,5 @@ admin = * #/api/interpreter/** = authc, roles[admin] #/api/configurations/** = authc, roles[admin] #/api/credential/** = authc, roles[admin] -#/api/callback = callbackFilter #/** = anon /** = authc diff --git a/docs/security/shiroauthentication.md b/docs/security/shiroauthentication.md index 5de1707d36b..7fd29ee94f1 100644 --- a/docs/security/shiroauthentication.md +++ b/docs/security/shiroauthentication.md @@ -165,40 +165,6 @@ securityManager.realms = $zeppelinHubRealm > Note: ZeppelinHub is not releated to Apache Zeppelin project. -### OpenID Connect -OpenID Connect enable you to integrate Zeppelin login with several providers(Google, AzureAD, Okta, IdentityServer3 (and 4), MitreID, Keycloak...). - -Support is provided by the use of: [Pac4j-oidc](http://www.pac4j.org/docs/clients/openid-connect.html) and [Buji-pac4j](https://github.com/bujiio/buji-pac4j). - -Specific configuration is strictly related to the provider, you need to configure the oidcClient to redirect you to the provider login page, handle the redirection back through the callback filter and add a SecurityFilter to check validity of the token. -More configuration parameters are available through [Buji-pac4j](https://github.com/bujiio/buji-pac4j) documentation. - -``` -### A sample for configuring Open ID Connect integration -oidcConfig = org.pac4j.oidc.config.OidcConfiguration -oidcConfig.discoveryURI = /realms//.well-known/openid-configuration -oidcConfig.clientId = -oidcConfig.secret = -oidcConfig.clientAuthenticationMethodAsString = client_secret_basic -oidcClient = org.pac4j.oidc.client.OidcClient -oidcClient.configuration = $oidcConfig -oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter -oidcSecurityFilter.config = $config -oidcSecurityFilter.clients = oidcClient - -clients = org.pac4j.core.client.Clients -clients.callbackUrl = http://:8080/api/callback -clients.clients = $oidcClient - -callbackFilter = io.buji.pac4j.filter.CallbackFilter -callbackFilter.defaultUrl = http://:8080 -callbackFilter.config = $config - -##add this route to urls -[urls] -/api/callback = callbackFilter -``` - ## Secure your Zeppelin information (optional) By default, anyone who defined in `[users]` can share **Interpreter Setting**, **Credential** and **Configuration** information in Apache Zeppelin. Sometimes you might want to hide these information for your use case. diff --git a/licenses/LICENSE-pac4j-1.9.8 b/licenses/LICENSE-pac4j-1.9.8 deleted file mode 100644 index f49a4e16e68..00000000000 --- a/licenses/LICENSE-pac4j-1.9.8 +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/pom.xml b/pom.xml index a6f5442dd3b..0eb29c55a1d 100644 --- a/pom.xml +++ b/pom.xml @@ -106,8 +106,6 @@ 3.2.1 1.1.1 1.3.2 - 1.9.8 - 2.2.0 4.12 diff --git a/zeppelin-distribution/src/bin_license/LICENSE b/zeppelin-distribution/src/bin_license/LICENSE index 60fe5c08c54..1fb63e27b45 100644 --- a/zeppelin-distribution/src/bin_license/LICENSE +++ b/zeppelin-distribution/src/bin_license/LICENSE @@ -96,8 +96,8 @@ The following components are provided under Apache License. (Apache 2.0) Lucene Suggest (org.apache.lucene:lucene-suggest:5.3.1 - http://lucene.apache.org/lucene-parent/lucene-suggest) (Apache 2.0) Elasticsearch: Core (org.elasticsearch:elasticsearch:2.1.0 - http://nexus.sonatype.org/oss-repository-hosting.html/parent/elasticsearch) (Apache 2.0) Joda convert (org.joda:joda-convert:1.8.1 - http://joda-convert.sourceforge.net) - (Apache 2.0) Shiro Core (org.apache.shiro:shiro-core:1.2.3 - https://shiro.apache.org) - (Apache 2.0) Shiro Web (org.apache.shiro:shiro-web:1.2.3 - https://shiro.apache.org) + (Apache 2.0) Shiro Core (org.apache.shiro:shiro-core:1.3.2 - https://shiro.apache.org) + (Apache 2.0) Shiro Web (org.apache.shiro:shiro-web:1.3.2 - https://shiro.apache.org) (Apache 2.0) SnakeYAML (org.yaml:snakeyaml:1.15 - http://www.snakeyaml.org) (Apache 2.0) Protocol Buffers (com.google.protobuf:protobuf-java:2.5.0 - https://github.com/google/protobuf/releases) (Apache 2.0) Alluxio Shell (org.alluxio:alluxio-shell:1.0.0 - http://alluxio.org) diff --git a/zeppelin-server/pom.xml b/zeppelin-server/pom.xml index 017d8ed880e..9a25d7d7f2f 100644 --- a/zeppelin-server/pom.xml +++ b/zeppelin-server/pom.xml @@ -113,36 +113,6 @@ shiro-web - - io.buji - buji-pac4j - ${buji.version} - - - org.pac4j - pac4j-core - - - - - - org.pac4j - pac4j-core - ${pac4j.version} - - - - org.pac4j - pac4j-oidc - ${pac4j.version} - - - org.apache.commons - commons-lang3 - - - - org.kohsuke libpam4j @@ -517,7 +487,6 @@ - using-source-tree From 80c375d42a3dc3f3de40360a0500c3c657ac2070 Mon Sep 17 00:00:00 2001 From: andrea Date: Mon, 19 Jun 2017 20:48:41 +0100 Subject: [PATCH 5/5] fixed style issues on master --- zeppelin-web/src/app/app.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/zeppelin-web/src/app/app.js b/zeppelin-web/src/app/app.js index 4822472f4c1..aed74686318 100644 --- a/zeppelin-web/src/app/app.js +++ b/zeppelin-web/src/app/app.js @@ -147,7 +147,6 @@ let zeppelinWebApp = angular.module('zeppelinWebApp', requiredModules) }) .constant('TRASH_FOLDER_ID', '~Trash') - function auth () { let $http = angular.injector(['ng']).get('$http') let baseUrlSrv = angular.injector(['zeppelinWebApp']).get('baseUrlSrv') @@ -160,25 +159,22 @@ function auth () { }, crossDomain: true }) - var config = {headers: { - "X-Requested-With": "XMLHttpRequest" - } - } + let config = {headers: { 'X-Requested-With': 'XMLHttpRequest' }} return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket', config).then(function (response) { zeppelinWebApp.run(function ($rootScope) { $rootScope.ticket = angular.fromJson(response.data).body $rootScope.ticket.screenUsername = $rootScope.ticket.principal - if ($rootScope.ticket.principal.startsWith("#Pac4j")) { - let re = ", name=(.*?)," + if ($rootScope.ticket.principal.startsWith('#Pac4j')) { + let re = ', name=(.*?),' $rootScope.ticket.screenUsername = $rootScope.ticket.principal.match(re)[1] } }) }, function (errorResponse) { // Handle error case - var redirect = errorResponse.headers('Location') - if (errorResponse.status == 401 && redirect != undefined) { - //handle page redirect + let redirect = errorResponse.headers('Location') + if (errorResponse.status === 401 && redirect !== undefined) { + // Handle page redirect window.location.href = redirect } })