Repository: helix
Updated Branches:
  refs/heads/master 41ff38670 -> ca364aecf


enforce login for all users


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/17c5f9ca
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/17c5f9ca
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/17c5f9ca

Branch: refs/heads/master
Commit: 17c5f9cac1656d522f06e29f9baa1f499ecc96e0
Parents: 41ff386
Author: Vivo Xu <v...@linkedin.com>
Authored: Mon Aug 27 14:04:21 2018 -0700
Committer: Vivo Xu <v...@linkedin.com>
Committed: Wed Oct 17 14:20:18 2018 -0700

----------------------------------------------------------------------
 helix-front/client/app/app.component.ts |  3 +--
 helix-front/server/controllers/user.ts  | 18 +++++++-----------
 2 files changed, 8 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/17c5f9ca/helix-front/client/app/app.component.ts
----------------------------------------------------------------------
diff --git a/helix-front/client/app/app.component.ts 
b/helix-front/client/app/app.component.ts
index 13d7426..06f7f5e 100644
--- a/helix-front/client/app/app.component.ts
+++ b/helix-front/client/app/app.component.ts
@@ -11,7 +11,6 @@ import { MatDialog } from '@angular/material';
 
 import { Angulartics2Piwik } from 'angulartics2';
 
-import { environment } from '../environments/environment';
 import { UserService } from './core/user.service';
 import { InputDialogComponent } from 
'./shared/dialog/input-dialog/input-dialog.component';
 import { HelperService } from './shared/helper.service';
@@ -67,7 +66,7 @@ export class AppComponent implements OnInit {
     this.dialog
       .open(InputDialogComponent, {
         data: {
-          title: 'Login',
+          title: 'Sign In',
           message: 'Please enter your LDAP username and password to continue:',
           values: {
             username: {

http://git-wip-us.apache.org/repos/asf/helix/blob/17c5f9ca/helix-front/server/controllers/user.ts
----------------------------------------------------------------------
diff --git a/helix-front/server/controllers/user.ts 
b/helix-front/server/controllers/user.ts
index 21e1b0f..980d97c 100644
--- a/helix-front/server/controllers/user.ts
+++ b/helix-front/server/controllers/user.ts
@@ -14,24 +14,20 @@ export class UserCtrl {
     router.route('/user/can').get(this.can);
   }
 
-  // please rewrite this function to support your own authorization logic
   protected authorize(req: Request, res: Response) {
-    if (req.query.name) {
-      // since it's bypass mode, skip admin check
-      req.session.username = req.query.name;
 
-      if (req.query.url) {
-        res.redirect(req.query.url);
-      } else {
-        res.redirect('/');
-      }
+    // you can rewrite this function to support your own authorization logic
+    // by default, doing nothing but redirection
+
+    if (req.query.url) {
+      res.redirect(req.query.url);
     } else {
-      res.status(401).send('Unauthorized');
+      res.redirect('/');
     }
   }
 
   protected current(req: Request, res: Response) {
-    res.json(req.session.username || 'Guest');
+    res.json(req.session.username || 'Sign In');
   }
 
   protected can(req: Request, res: Response) {

Reply via email to