-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ZEPPELIN-2598] Securing Zeppelin with OpenID Connect #2373
Changes from 6 commits
4ce9121
03bbe30
545686d
7ec8cdd
80c375d
31270f2
2d5af6d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,8 +95,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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @felixcheung already updated |
||
(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) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,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) { | ||
|
@@ -175,12 +176,24 @@ function auth () { | |
}, | ||
crossDomain: true | ||
}) | ||
return $http.get(baseUrlSrv.getRestApiBase() + '/security/ticket').then(function (response) { | ||
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=(.*?),' | ||
$rootScope.ticket.screenUsername = $rootScope.ticket.principal.match(re)[1] | ||
} | ||
}) | ||
}, function (errorResponse) { | ||
// Handle error case | ||
let redirect = errorResponse.headers('Location') | ||
if (errorResponse.status === 401 && redirect !== undefined) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't redirect be error code 3xx instead of 4xx? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the redirect could not be performed automatically, since we are doing our requests with ajax. |
||
// Handle page redirect | ||
window.location.href = redirect | ||
} | ||
}) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,7 +90,7 @@ | |
<i ng-if="!navbar.connected" class="fa fa-circle server-disconnected" | ||
uib-tooltip="WebSocket Disconnected" tooltip-placement="bottom" style="margin-top: 7px; vertical-align: top"></i> | ||
<button ng-if="ticket" class="nav-btn dropdown-toggle" type="button" data-toggle="dropdown" style="margin:11px 5px 0 0; padding-left: 0px;"> | ||
<span class="username">{{ticket.principal}}</span> | ||
<span class="username">{{ticket.screenUsername}}</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and the reason for this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that going to change the output for cases other than buji? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I made a filter with: if ($rootScope.ticket.principal.startsWith("#Pac4j")) { I hope is reasonably enough There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is not "out of the box" but zeppelin could now support this integration There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it only limited to having pac4j on the classpath and necessary configuration in shiro.ini? Or does it required some code changes in Zeppelin as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pac4j and maybe other dependencies on classpath and configuration is enough! We are integrating with Keycloak i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried with following shiro.ini configuration with all the required jars on classpath. It is not working. I am getting following error authentication token of type [class org.apache.shiro.authc.UsernamePasswordToken] could not be authenticated by any configured realms. sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager securityManager.sessionManager = $sessionManager oidcConfig = org.pac4j.oidc.config.OidcConfiguration config = org.pac4j.core.config.Config requireRoleAdmin = org.pac4j.core.authorization.authorizer.RequireAnyRoleAuthorizer oidcSecurityFilter = io.buji.pac4j.filter.SecurityFilter config.clients = $clients pac4jRealm = io.buji.pac4j.realm.Pac4jRealm callbackFilter = io.buji.pac4j.filter.CallbackFilter securityManager.sessionManager.globalSessionTimeout = 86400000 [urls] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am setting up Google OpenID client, the login on Zeppelin should take me to Google account but it is opening Zeppelin Login form, what setup is needed in shiro.ini to correct this behavior? |
||
<span class="caret" style="margin-bottom: 8px"></span> | ||
</button> | ||
<span ng-if="!ticket" style="margin: 5px;"></span> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update shiro version in
zeppelin-distribution/src/bin-license/LICENSE
?