You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/08/02 20:31:43 UTC

[GitHub] [trafficcontrol] mattjackson220 commented on a change in pull request #3763: Oauth authentication rebase

mattjackson220 commented on a change in pull request #3763: Oauth authentication rebase
URL: https://github.com/apache/trafficcontrol/pull/3763#discussion_r310288017
 
 

 ##########
 File path: traffic_portal/app/src/common/api/AuthService.js
 ##########
 @@ -51,6 +51,30 @@ var AuthService = function($rootScope, $http, $state, $location, userModel, mess
         );
     };
 
+    this.oauthLogin = function(authCodeTokenUrl, code, clientId, redirectUri) {
+        return $http.post(ENV.api['root'] + 'user/login/oauth', { authCodeTokenUrl: authCodeTokenUrl, code: code, clientId: clientId, redirectUri: redirectUri})
+            .then(
+                function(result) {
+                    $rootScope.$broadcast('authService::login');
+                    var redirect = localStorage.getItem('redirectParam');
+                    localStorage.clear();
+                    if (redirect === undefined || redirect === '') {
+                        redirect = decodeURIComponent($location.search().redirect);
+                    }
+                    if (redirect !== undefined) {
+                        $location.search('redirect', null); // remove the redirect query param
+                        $location.url(redirect);
+                    } else {
+                        $location.url('/');
+                    }
+                },
+                function(fault) {
+                    messageModel.setMessages(fault.data.alerts, true);
+                    locationUtils.navigateToPath('/');
 
 Review comment:
   done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services