Skip to content

Commit

Permalink
oauth: Create CERN OAuth blueprint to allow redirection to login.cern…
Browse files Browse the repository at this point in the history
….ch logout
  • Loading branch information
Pablo Panero authored and lnielsen committed Dec 11, 2018
1 parent 2927749 commit 6bd5c9b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion invenio_oauthclient/contrib/cern.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import re
from datetime import datetime, timedelta

from flask import current_app, g, redirect, session, url_for
from flask import Blueprint, current_app, g, redirect, session, url_for
from flask_login import current_user
from flask_principal import AnonymousIdentity, RoleNeed, UserNeed, \
identity_changed, identity_loaded
Expand Down Expand Up @@ -137,6 +137,7 @@
setup='invenio_oauthclient.contrib.cern:account_setup',
view='invenio_oauthclient.handlers:signup_handler',
),
logout_url='https://login.cern.ch/adfs/ls/partiallogout.aspx',
params=dict(
base_url='https://oauth.web.cern.ch/',
request_token_url=None,
Expand All @@ -163,6 +164,15 @@
REMOTE_APP_RESOURCE_API_URL = 'https://oauthresource.web.cern.ch/api/Me'
REMOTE_APP_RESOURCE_SCHEMA = 'http://schemas.xmlsoap.org/claims/'

cern_oauth_blueprint = Blueprint('cern_oauth', __name__)


@cern_oauth_blueprint.route('/cern/logout')
def logout():
"""CERN logout view."""
return redirect(REMOTE_APP['logout_url'],
code=302)


def find_remote_by_client_id(client_id):
"""Return a remote application based with given client ID."""
Expand Down

0 comments on commit 6bd5c9b

Please sign in to comment.