From 60856cb7b91fb35dd68556c98518287d9250a219 Mon Sep 17 00:00:00 2001 From: Robert Picard Date: Tue, 22 Dec 2015 14:37:29 -0500 Subject: [PATCH] Add an endpoint to return active authentication providers This endpoint can be used by Angular to figure out what authentication options to display to the user. It returns a dictionary of configuration details that the front-end needs for each provider. --- docs/administration/index.rst | 38 ++++++++++++++++++- lemur/auth/views.py | 34 +++++++++++++++++ lemur/static/app/angular/app.js | 25 ++++++------ .../app/angular/authentication/login/login.js | 1 + .../authentication/login/login.tpl.html | 4 +- .../app/angular/authentication/services.js | 4 ++ 6 files changed, 90 insertions(+), 16 deletions(-) diff --git a/docs/administration/index.rst b/docs/administration/index.rst index f9cf293b..9dd94952 100644 --- a/docs/administration/index.rst +++ b/docs/administration/index.rst @@ -262,11 +262,18 @@ for those plugins. Authentication -------------- -Lemur currently supports Basic Authentication and Ping OAuth2 out of the box. Additional flows can be added relatively easily. -If you are not using Ping you do not need to configure any of these options. +Lemur currently supports Basic Authentication, Ping OAuth2, and Google out of the box. Additional flows can be added relatively easily. +If you are not using an authentication provider you do not need to configure any of these options. For more information about how to use social logins, see: `Satellizer `_ +.. data:: ACTIVE_PROVIDERS + :noindex: + + :: + + ACTIVE_PROVIDERS = ["ping", "google"] + .. data:: PING_SECRET :noindex: @@ -296,6 +303,33 @@ For more information about how to use social logins, see: `Satellizer
-
diff --git a/lemur/static/app/angular/authentication/services.js b/lemur/static/app/angular/authentication/services.js index dddffeb4..7719b444 100644 --- a/lemur/static/app/angular/authentication/services.js +++ b/lemur/static/app/angular/authentication/services.js @@ -6,6 +6,10 @@ angular.module('lemur') .service('AuthenticationService', function ($location, $rootScope, AuthenticationApi, UserService, toaster, $auth) { var AuthenticationService = this; + AuthenticationService.get_providers = function () { + return AuthenticationApi.one('providers').get(); + }; + AuthenticationService.login = function (username, password) { AuthenticationApi.customPOST({'username': username, 'password': password}, 'login') .then(