Rename MSP plugin as FC plugin

This commit is contained in:
Benjamin Dauvergne 2015-05-27 16:07:44 +02:00
parent c7f983451a
commit 5f6e90e32e
100 changed files with 655 additions and 1009 deletions

View File

@ -1,2 +1,2 @@
authentic2-auth-msp is entirely under the copyright of Entr'ouvert and
authentic2-auth-fc is entirely under the copyright of Entr'ouvert and
distributed under the license AGPLv3 or later.

View File

@ -1,4 +1,4 @@
include COPYING
recursive-include src/authentic2_auth_msp/templates *.html
recursive-include src/authentic2_auth_msp/static *.js *.css *.png *.gif *.jpg
recursive-include src/authentic2_auth_msp/locale *.po *.mo
recursive-include src/authentic2_auth_fc/templates *.html
recursive-include src/authentic2_auth_fc/static *.js *.css *.png *.gif *.jpg
recursive-include src/authentic2_auth_fc/locale *.po *.mo

56
README
View File

@ -1,40 +1,38 @@
authentic2-auth-msp
authentic2-auth-fc
===================
Authentic2 plugin to authenticate against *mon.service-public.fr* the french
citizen portal.
Authentic2 plugin to authenticate against *France Connect* the french
citizen and entreprise SSO.
Installation
============
- Install with `pip install authentic2-auth-msp`
- Add `A2_MSP_ENABLED = True` to your `local_settings.py` file
- Install with `pip install authentic2-auth-fc`
- Add `A2_FC_ENABLED = True` to your `local_settings.py` file
- Define the needed parameters::
MSP_CLIENT_ID = 'id assigned by DIMAP'
MSP_CLIENT_SECRET = 'secret assigned by DIMAP'
MSP_CLIENT_CERTIFICATE = ('/my-path/my-certificate.crt', '/my-path/my-certificate.key')
MSP_VERIFY_CERTIFICATE = False
FC_CLIENT_ID = 'id assigned by DISIC'
FC_CLIENT_SECRET = 'secret assigned by DISIC'
FC_VERIFY_CERTIFICATE = False # True for production
Test
====
Platforms
=========
When testing agains the test platform of mon.service-public.fr you must change
When testing against another platform of France Connect you must change
the default endpoints URL in your `local_settings.py` file::
You must plug the application views in your urls.py file by adding this
content::
MSP_AUTHORIZE_URL = 'https://mon.service-public.fr/apis/app/oauth/authorize'
MSP_TOKEN_URL = 'https://mon.service-public.fr:2443/apis/app/oauth/token'
MSP_API_URL = 'https://mon.service-public.fr:2443/apis/'
FC_AUTHORIZE_URL = 'https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize'
FC_TOKEN_URL = 'https://fcp.integ01.dev-franceconnect.fr/api/v1/token'
FC_USERINFO_URL = 'https://fcp.integ01.dev-franceconnect.fr/api/v1/userinfo'
FC_LOGOUT_URL = 'https://fcp.integ01.dev-franceconnect.fr/api/v1/logout'
MSP Gateway
FC Gateway
===========
If you want to use the OAuth2 proxy to share the access to MSP apis, you must
user a shared cache backend: through memcached, redis or the ORM. For
example if you have a memcached installed just add the following fragment to
your settings::
If you want to use the OAuth2 proxy to share the access to a FC data
provider, you must user a shared cache backend: through memcached, redis
or the ORM. For example if you have a memcached installed just add the
following fragment to your settings::
CACHES = {
'default': {
@ -43,19 +41,19 @@ your settings::
}
}
If you want a specific cache backend for the MSP plugin, use the `msp` name
If you want a specific cache backend for the FC plugin, use the `fc` name
for your cache instead of `default`.
The msp application also provides an OAuth2 gateway to MSP. To configure it your
The fc application also provides an OAuth2 gateway to FC. To configure it your
just need to provider a list of client_id, client_secret pairs in your
settings, like that::
MSP_CLIENT_CREDENTIALS = (('client_id1', 'client_secret1'),)
FC_CLIENT_CREDENTIALS = (('client_id1', 'client_secret1'),)
The following URL are provided:
- /msp/authorize : like the authorize URL of MSP
- /msp/access_token : like the access_token URL of MSP
- /msp/documents/ : like the document list REST API endpoint of MSP
- /msp/documents/<id>/ : like the document retrieval REST API endpoint of MSP
- /fc/authorize : like the authorize URL of FC
- /fc/access_token : like the access_token URL of FC
- /fc/documents/ : like the document list REST API endpoint of FC
- /fc/documents/<id>/ : like the document retrieval REST API endpoint of FC

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
python-authentic2-auth-msp (1.0.1-0) wheezy; urgency=low
python-authentic2-auth-fc (1.0.1-0) wheezy; urgency=low
* First upstream release

4
debian/control vendored
View File

@ -1,4 +1,4 @@
Source: python-authentic2-auth-msp
Source: python-authentic2-auth-fc
Maintainer: Benjamin Dauvergne <info@entrouvert.com>
Section: python
Priority: optional
@ -7,7 +7,7 @@ Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6), debhelper (>=
Standards-Version: 3.9.1
X-Python-Version: >= 2.6
Package: python-authentic2-auth-msp
Package: python-authentic2-auth-fc
Architecture: all
Depends: ${misc:Depends},
python-authentic2 (>= 2.1.2),

View File

@ -86,29 +86,29 @@ README = file(os.path.join(
os.path.dirname(__file__),
'README')).read()
setup(name='authentic2-auth-msp',
setup(name='authentic2-auth-fc',
version=get_version(),
license='AGPLv3',
description='Authentic2 mon.service-public.fr plugin',
description='Authentic2 FranceConnect plugin',
long_description=README,
author="Entr'ouvert",
url='https://repos.entrouvert.org/authentic2-auth-msp.git',
url='https://repos.entrouvert.org/authentic2-auth-fc.git',
author_email="info@entrouvert.com",
packages=find_packages('src'),
package_dir={
'': 'src',
},
package_data={
'authentic2_auth_msp': [
'templates/authentic2_auth_msp/*.html',
'static/authentic2_auth_msp/js/*.js',
'static/authentic2_auth_msp/css/*.css',
'static/authentic2_auth_msp/img/*.png',
'static/authentic2_auth_msp/img/*.jpg',
'static/authentic2_auth_msp/img/*.gif',
'static/authentic2_auth_msp/img/bg/*.png',
'static/authentic2_auth_msp/img/bg/*.jpg',
'static/authentic2_auth_msp/img/bg/*.gif',
'authentic2_auth_fc': [
'templates/authentic2_auth_fc/*.html',
'static/authentic2_auth_fc/js/*.js',
'static/authentic2_auth_fc/css/*.css',
'static/authentic2_auth_fc/img/*.png',
'static/authentic2_auth_fc/img/*.jpg',
'static/authentic2_auth_fc/img/*.gif',
'static/authentic2_auth_fc/img/bg/*.png',
'static/authentic2_auth_fc/img/bg/*.jpg',
'static/authentic2_auth_fc/img/bg/*.gif',
'locale/fr/LC_MESSAGES/django.po',
'locale/fr/LC_MESSAGES/django.mo',
],
@ -121,7 +121,7 @@ setup(name='authentic2-auth-msp',
],
entry_points={
'authentic2.plugin': [
'authentic2-auth-msp = authentic2_auth_msp:Plugin',
'authentic2-auth-fc = authentic2_auth_fc:Plugin',
],
},
cmdclass={

View File

@ -9,7 +9,7 @@ class Plugin(object):
return [__name__, 'sekizai']
def get_authentication_backends(self):
return ['authentic2_auth_msp.backends.MspBackend']
return ['authentic2_auth_fc.backends.FcBackend']
def get_auth_frontends(self):
return ['authentic2_auth_msp.auth_frontends.MspFrontend']
return ['authentic2_auth_fc.auth_frontends.FcFrontend']

View File

@ -21,15 +21,19 @@ class AppSettings(object):
@property
def authorize_url(self):
return self._setting('AUTHORIZE_URL', 'https://mon.service-public.fr/apis/app/oauth/authorize')
return self._setting('AUTHORIZE_URL', 'https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize')
@property
def token_url(self):
return self._setting('TOKEN_URL', 'https://mon.service-public.fr:2443/apis/app/oauth/token')
return self._setting('TOKEN_URL', 'https://fcp.integ01.dev-franceconnect.fr/api/v1/token')
@property
def api_url(self):
return self._setting('API_URL', 'https://mon.service-public.fr:2443/apis/')
def userinfo_url(self):
return self._setting('USERINFO_URL', 'https://fcp.integ01.dev-franceconnect.fr/api/v1/userinfo')
@property
def logout_url(self):
return self._setting('LOGOUT_URL', 'https://fcp.integ01.dev-franceconnect.fr/api/v1/logout')
@property
def client_id(self):
@ -39,10 +43,6 @@ class AppSettings(object):
def client_secret(self):
return self._setting('CLIENT_SECRET')
@property
def client_certificate(self):
return self._setting('CLIENT_CERTIFICATE', None)
@property
def verify_certificate(self):
return self._setting('VERIFY_CERTIFICATE', False)
@ -51,13 +51,8 @@ class AppSettings(object):
def client_credentials(self):
return self._setting('CLIENT_CREDENTIALS', ())
@property
def more_url(self):
return self._setting('MORE_URL', 'https://mon.service-public.fr/')
import sys
app_settings = AppSettings('A2_MSP_')
app_settings = AppSettings('A2_FC_')
app_settings.__name__ = __name__
sys.modules[__name__] = app_settings

View File

@ -5,25 +5,25 @@ from django.shortcuts import render
from . import app_settings
class MspFrontend(object):
class FcFrontend(object):
def enabled(self):
return app_settings.enabled
def name(self):
return gettext_noop('mon.service-public.fr')
return gettext_noop('France Connect')
def id(self):
return 'msp'
return 'fc'
def login(self, request, *args, **kwargs):
if 'nomsp' in request.GET:
if 'nofc' in request.GET:
return
context_instance = kwargs.pop('context_instance', None)
return render(request, 'authentic2_auth_msp/login.html',
return render(request, 'authentic2_auth_fc/login.html',
context_instance=context_instance)
def profile(self, request, *args, **kwargs):
context_instance = kwargs.pop('context_instance', None) or RequestContext(request)
return render_to_string('authentic2_auth_msp/linking.html', {'popup': True},
return render_to_string('authentic2_auth_fc/linking.html', {'popup': True},
context_instance=context_instance)

View File

@ -3,12 +3,12 @@ from . import models
from django.contrib.auth.backends import ModelBackend
class MspBackend(ModelBackend):
class FcBackend(ModelBackend):
def authenticate(self, agc=None, **kwargs):
try:
msp_account = models.MspAccount.objects.get(agc=agc)
return msp_account.user
except models.MspAccount.DoesNotExist:
fc_account = models.FcAccount.objects.get(agc=agc)
return fc_account.user
except models.FcAccount.DoesNotExist:
pass
def get_saml2_authn_context(self):

View File

@ -1,11 +1,11 @@
# Authentic2 Mon.service-public.fr plugin french translations
# Copyright (C) 2014 Entr'ouvert
# This file is distributed under the same license as the authentic2-auth-msp package.
# This file is distributed under the same license as the authentic2-auth-fc package.
# Benjamin Dauvergne <bdauvergne@entrouvert.com, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: authentic2-auth-msp 1.0\n"
"Project-Id-Version: authentic2-auth-fc 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-12-10 15:56+0100\n"
"PO-Revision-Date: 2014-12-10 16:00+0100\n"
@ -38,22 +38,22 @@ msgid "request denied by user"
msgstr "Demande refusée par l'utilisateur !"
#: views.py:196
msgid "no local account is linked to your MSP account"
msgid "no local account is linked to your FC account"
msgstr ""
"Vous n'avez aucun compte relié à Mon Service-Public actuellement ! Veuillez "
"d'abord vous connecter avec votre compte pour faire une demande decréation "
"de liaison."
#: views.py:218
msgid "msp link already exists"
msgid "fc link already exists"
msgstr "Une liaison avec mon.Service-Public.fr existe déjà."
#: views.py:224 views.py:487
msgid "msp link created"
msgid "fc link created"
msgstr "La liaison avec mon.Service-Public.fr est créée."
#: views.py:490
msgid "to create a link with msp, please authenticate"
msgid "to create a link with fc, please authenticate"
msgstr ""
"Pour créer une nouvelle liaison avec mon.Service-Public.fr, veuillez vous "
"authentifier."

View File

@ -14,14 +14,14 @@ from django.dispatch import receiver
from . import app_settings
class MspAccountManager(models.Manager):
class FcAccountManager(models.Manager):
def cleanup(self):
for msp_account in self.filter(Q(user__isnull=True)
for fc_account in self.filter(Q(user__isnull=True)
|Q(user__deleteduser__isnull=False)):
msp_account.delete()
fc_account.delete()
class MspAccount(models.Model):
class FcAccount(models.Model):
user = models.OneToOneField(user_model_label,
verbose_name=_('user'),
default=None,
@ -30,17 +30,17 @@ class MspAccount(models.Model):
agc = models.CharField(max_length=64, verbose_name=_('access grant code'))
token = models.TextField(verbose_name=_('access token'))
objects = MspAccountManager()
objects = FcAccountManager()
def delete(self, *args, **kwargs):
logger = logging.getLogger(__name__)
try:
self.api_call('app/rest/agc', method='delete')
logger.info('msp link deleted for %r', unicode(self.user))
logger.info('fc link deleted for %r', unicode(self.user))
except requests.RequestException:
logger.warn('msk failed to delete link for %r, deleting locally '
'anyway', unicode(self.user))
super(MspAccount, self).delete(*args, **kwargs)
super(FcAccount, self).delete(*args, **kwargs)
def api_call(self, api_path, method='get', **kwargs):
url = urlparse.urljoin(app_settings.api_url, api_path)
@ -48,7 +48,7 @@ class MspAccount(models.Model):
token=json.loads(self.token))
return getattr(session, method)(url,
verify=app_settings.verify_certificate,
cert=app_settings.client_certificate, **kwargs)
**kwargs)
def refresh_token(self):
logger = logging.getLogger(__name__)
@ -63,13 +63,12 @@ class MspAccount(models.Model):
'client_secret': app_settings.client_secret,
}
response = requests.post(app_settings.token_url,
data=data, verify=app_settings.verify_certificate,
cert=app_settings.client_certificate)
data=data, verify=app_settings.verify_certificate)
new_token = response.json()
if 'error' in new_token:
if new_token['error'] == 'invalid_grant':
logger.warning('obsolete token %r, deleting MspAccount %r', self.token,
logger.warning('obsolete token %r, deleting FcAccount %r', self.token,
self.agc)
self.delete()
return False
@ -81,15 +80,15 @@ class MspAccount(models.Model):
@receiver(post_save)
def delete_msp_account_on_account_deletion(sender, instance, created, *args, **kwargs):
def delete_fc_account_on_account_deletion(sender, instance, created, *args, **kwargs):
from authentic2.models import DeletedUser
if sender is not DeletedUser:
return
if not created:
return
logger = logging.getLogger(__name__)
for msp_account in MspAccount.objects.filter(user=instance.user):
for fc_account in FcAccount.objects.filter(user=instance.user):
try:
msp_account.delete()
fc_account.delete()
except:
logger.exception('unable to delete msp accounts')
logger.exception('unable to delete fc accounts')

View File

@ -0,0 +1,3 @@
#fc-link-management, #fc-confirm-unlink {
margin-top: 15px;
}

View File

@ -0,0 +1,347 @@
#fc-linking {
margin: 0px 100px;
}
.fc{
margin:0 auto 0 auto;
text-align:left;
font-size:11px;
position:relative;
padding:0 0 0px 0;
color:#2B2A91;
font-family:arial, verdana, sans-serif;
}
.fc.connecting {
width: 35em;
}
.fc *{
font-family:arial, verdana, sans-serif;
font-size:100%;
}
.fc p, .fc form, .fc h1, .fc h2, .fc h3, .fc h4, .fc h5, .fc h6, .fc input{
margin:0;
font-weight:normal;
}
.fc ul, .fc ol{
list-style-type:none;
padding:0;
margin:0;
}
* html .fc li{
height:1%;
}
.fc fieldset{
background:#dae7ef url(../img/bg/degrade.jpg) left 0 repeat-x;
border:1px solid #2B2A91;
margin:0;
padding:0;
}
.fc img{width:auto!important}
.fc a img{border:none}
.fc .alc{text-align:center}
.fc .db{display:block}
.fc .cb {clear:both}
.fc .flr{float:right!important}
.fc .m30 {margin:30px}
.fc .mb20 {margin-bottom:20px}
.fc .fz {font-size:110%}
.fc .fz2 {font-size:130%}
.fc .fz3 {font-size:105%!important}
.fc .bnone {border:none!important}
.fc .fz2 a {font-weight:bold}
.fc p{margin:0 0 0.5em 0;padding:0}
.fc a{background-color:inherit;color:#31579C!important}
.fc a.roll,.fc a.none{text-decoration:none!important}
.fc a.roll:hover{text-decoration:underline!important}
.fc .bordure{border:2px solid #FFF;position:relative}
* html .fc .bordure {height:1%}
*:first-child+html .fc .bordure {min-height:1%}
.fc .bordure:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.fc .marges{padding:0.4em}
.fc fieldset .marges{padding:0 1em 0 1.25em}
.fc fieldset .marges.top {padding-top:1em}
.fc fieldset legend{background-color:#FFF;color:#2B2A91;margin-left:0.5em}
.fc fieldset legend span{display:block;font-size:130%;font-weight:700;padding:0 0.5em 1em;position:relative;top:0.5em}
.fc p img{vertical-align:middle}
.fc p input.checkbox{vertical-align:middle}
.fc p.lien{text-align:right}
.fc p.lien a{background:url(../img/bg/fleche.png) 0 4px no-repeat;padding-left:12px}
.fc label{cursor:pointer;font-weight:700}
.fc .cadre{background:#FFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.fc .centrer{text-align:center}
.fc .centrer img{display:block;width:150px;margin:0 auto}
.fc li .lien{text-align:left !important}
.fc li.picto{background-position:2px 2px;background-repeat:no-repeat;padding-left:20px}
.fc li.utilisateur{background-image:url(../img/bg/utilisateur.png)}
.fc li.fermer{background-image:url(../img/bg/fermer.png)}
.fc .message{background-color:#E7E7F7;border-left:10px solid #B5CEEE;color:#000;padding:1em}
* html .fc .message{height:1%}
.fc .message p{margin:0}
.fc .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.fc .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF!important}
.fc small a{background-color:inherit;background-image:url(../img/bg/retour.png);background-position:0 50%;background-repeat:no-repeat;color:#000;float:right;margin-right:30px;margin-top:-2em;padding-left:20px;font-size:90%}
.fc h1{background-color:inherit;color:#31579C;font-size:200%;margin:0.5em 0 0.5em 30px;padding:0;font-weight:bold}
.fc .contenu{background-color:inherit;color:#000;display:inline;float:left;margin-left:30px;padding-bottom:2em;width:445px}
.fc .menu{background-color:inherit;color:#000;display:inline;float:left;margin:0 30px;padding-bottom:2em;width:215px}
.fc .retablir{clear:both;display:block;height:1px;margin-top:-1px;overflow:hidden;width:1px}
.fc .encart{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x ;border:1px solid #2B2A91}
.fc .encart h2{background-color:#5E81C1;color:#FFF;font-size:100%;font-weight:bold;margin:0;padding:1px 6px}
.fc .encart p{margin:1em}
.fc .contenu ul{margin:2em 0}
.fc .contenu li.utilisateur{background-image:url(../img/bg/utilisateur_blanc.png)}
.fc .important{background-color:#E1E9F8;color:inherit;margin-bottom:0.5em;padding:0.5em}
.fc .important p{margin:0;padding:0;font-weight:bold}
.fc .contenu li p{padding:0}
.fc a.marges{margin-right:20px;padding:0}
.fc .barre{border-left:10px solid #B5CEEE;font-weight:bold;padding-left:20px}
.fc .barre ul{font-weight:400}
.fc em{background-color:inherit;color:#31579C;display:block;font-weight:700;margin:1.5em 0;text-align:center}
.fc .contenu ul strong{background-image:url(../img/bg/fleche.png);background-position:0 4px;background-repeat:no-repeat;padding-left:15px}
.fc .connexion{font-weight:bold;color:#FFF!important;background-color:inherit!important;text-decoration:none!important;background-image:url(../img/bg/connect.png);background-position:100% 50%;padding:0 25px 0 15px;text-transform:uppercase;font-size:120%}
.fc .fond li.central {padding:0 0.5em 1em;text-align:center}
.fc .note,.fc .joindre{background:#010d23 url(../img/bg/note2.gif) 0 0 repeat-x}
.fc .note span,.fc .joindre span{background:url(../img/bg/note.png) 0 0 no-repeat;display:block;padding:4px 5px 4px 20px;min-height:14px;font-weight:bold}
.fc .joindre span{background-image:url(../img/bg/note.png)}
* html .fc .note span,* html .fc .joindre span{height:14px;}
.fc .note a,.fc .joindre a{color:#FFF!important;text-decoration:none}
.fc .user{background:#2b5973 url(../img/bg/user_2.png) top left no-repeat ;padding:3px 10px 3px 18px!important;float:left;display:inline;color:#FFF!important;font-weight:bold;text-decoration:none}
.fc .bis{background-image:url(../img/bg/user.png);color:#1A2D4E!important;background-color:inherit;border:1px solid #C4D7DF;padding:2px 10px 2px 18px!important}
.fc.bloc {width:99%;border:1px solid #31579C}
.fc .cadre{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.fc .centrer{text-align:center}
.fc .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.fc .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF}
/* en savoir plus */
.fc_esp{
font-family:arial, verdana, sans-serif;
background:#FFF;
margin:24px 0 40px 19px;
border:1px solid #4b4da4;
width:712px;
padding:0 0 55px 0;
font-size:11px;
text-align:left;
position:relative;
}
.fc_esp *{
font-family:arial, verdana, sans-serif;
font-size:100%;
color:#434343;
}
.fc_esp p, .fc_esp h1, .fc_esp h2, .fc_esp h3, .fc_esp form{
margin:0;
font-weight:normal;
}
.fc_esp_h{
position:absolute;
left:4px;
top:4px;
width:704px;
height:213px;
background:url(../img/fond_ensavoirplus_h.jpg) 0 0 no-repeat;
}
.fc_esp_b{
position:absolute;
left:4px;
bottom:4px;
width:704px;
height:55px;
background:url(../img/fond_ensavoirplus_b.jpg) 0 0 repeat-x;
}
.fc_esp_header{
margin:0 0 -6px 0;
}
.fc_esp_header:after{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
* html .fc_esp_header{
height:1%;
}
*:first-child+html .fc_esp_header{
min-height:1%;
}
.fc_esp_intro{
position:relative;
padding:0 0 0 20px;
float:left;
width:548px;
}
* html .fc_esp_intro{
width:558px;
}
.fc_esp_header a,
.fc_esp_header a:hover{
position:relative;
float:left;
background:url(../img/visite_guidee.png) 0 0 no-repeat;
display:block;
width:125px;
height:122px;
margin:30px 0 0 0;
overflow:hidden;
text-indent:-999em;
cursor:pointer;
cursor:hand;
}
* html .fc_esp_header a{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/visite_guidee.png',sizingMethod='crop');
}
.fc_esp_pgtitre{
color:#31579c;
font-size:150%;
text-transform:uppercase;
padding:30px 0 10px 0;
}
.fc_esp_pgtitre span{
color:#31579c;
font-size:210%;
line-height:90%;
}
.fc_esp_intro p{
font-size:110%;
line-height:150%;
font-weight:bold;
padding:0 10px 0 0;
}
.fc_esp_cont{
margin:0 12px 0 12px;
position:relative;
padding:24px 0 24px 0;
}
* html .fc_esp_cont{
height:1%;
}
*:first-child+html .fc_esp_cont{
min-height:1%;
}
.fc_esp_cont-h{
position:absolute;
top:0;
left:0;
width:680px;
height:24px;
background:url(../img/ombre_content_h.png) 0 0 no-repeat;
}
* html .fc_esp_cont-h{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_h.png',sizingMethod='crop');
}
.fc_esp_cont-b{
position:absolute;
bottom:0;
left:0;
width:688px;
height:24px;
background:url(../img/ombre_content_b.png) 0 0 no-repeat;
}
* html .fc_esp_cont-b{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_b.png',sizingMethod='crop');
}
.fc_esp_cont-m{
background:url(../img/ombre_content_m.png) 0 0 repeat-y;
padding:0 14px 0 14px;
}
* html .fc_esp_cont-m{
height:1%;
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_m.png',sizingMethod='scale');
}
.fc_esp_pres .fc_esp_sub,
.fc_esp_sub{
text-align:center;
padding:0 0 4px 0;
min-height:1px;
font-size:100%;
}
* html .fc_esp_pres div .fc_esp_sub{
height:auto;
}
.fc_esp_sub a,
.fc_esp_sub a:hover{
display:-moz-inline-box;
background:#010D23 url(../img/bk-input.gif) 0 0 repeat-x;
color:#fff;
border:none;
padding:3px 60px;
text-transform:uppercase;
font-weight:bold;
cursor:pointer;
cursor:hand;
text-decoration:none;
min-height:22px;
}
* html .fc_esp_sub a{
display:inline-block;
height:16px;
}
*:first-child+html .fc_esp_sub a{
display:inline-block;
min-height:16px;
}
.fc_esp_cont-degh{
background:url(../img/deg_content_h.png) 0 0 repeat-x;
}
.fc_esp_cont-degb{
background:url(../img/deg_content_b.png) 0 100% repeat-x;
padding:0 8px 0 8px;
}
.fc_esp_cont-m .fc_esp_btitre{
padding:4px 0 5px 0;
color:#31579c;
font-weight:bold;
font-size:120%;
}
.fc_esp_pres div p{
padding:6px 12px 20px 70px;
font-size:110%;
min-height:65px;
}
* html .fc_esp_pres .fc_esp_cont-degb div p{
height:83px;
}
.fc_esp_pres .fc_esp_btitre{
color:#fff;
padding:4px 10px 5px 10px;
}
.fc_esp_bloc1 .fc_esp_btitre{
background:#143152 url(../img/fond_titre_1.png) 0 0 repeat-x;
}
.fc_esp_bloc1 p{
background:url(../img/illus_1.jpg) 0 0 no-repeat;
}
.fc_esp_bloc2 .fc_esp_btitre{
background:#386722 url(../img/fond_titre_2.png) 0 0 repeat-x;
}
.fc_esp_bloc2 p{
background:url(../img/illus_2.jpg) 0 0 no-repeat;
}
.fc_esp_bloc3 .fc_esp_btitre{
background:#815302 url(../img/fond_titre_3.png) 0 0 repeat-x;
}
.fc_esp_bloc3 p{
background:url(../img/illus_3.jpg) 0 0 no-repeat;
}
.fc_esp_bloc4 .fc_esp_btitre{
background:#862e78 url(../img/fond_titre_4.png) 0 0 repeat-x;
}
.fc_esp_bloc4 p{
background:url(../img/illus_4.jpg) 0 0 no-repeat;
}
.fc_esp_logos {
text-align:center;
list-style-type:none;
padding:0;
margin:12px 0 4px 0;
}
.fc_esp_logos li{
display:inline;
margin:0 8px 0 3px;
}

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 234 B

View File

Before

Width:  |  Height:  |  Size: 196 B

After

Width:  |  Height:  |  Size: 196 B

View File

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 108 B

View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

View File

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 128 B

View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

View File

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 360 B

View File

Before

Width:  |  Height:  |  Size: 558 B

After

Width:  |  Height:  |  Size: 558 B

View File

Before

Width:  |  Height:  |  Size: 108 B

After

Width:  |  Height:  |  Size: 108 B

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 858 B

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 512 B

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -5,13 +5,13 @@
{% block content %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/screen.msp.css' %}"></link>{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/msp.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/oauth.js" %}"></script>{% endaddtoblock %}
<div id="msp-confirm-unlink">
<div class="msp">
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/screen.fc.css' %}"></link>{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/fc.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/oauth.js" %}"></script>{% endaddtoblock %}
<div id="fc-confirm-unlink">
<div class="fc">
<div class="cadre">
<div class="bordure">
<h1>Gestion des liaisons&nbsp;: confirmation de suppression</h1>
@ -30,7 +30,7 @@
</div>
<div class="m30">
<p class="mb20">
<a href="{% url 'msp-unlink' %}?next={{ next|urlencode }}{% if popup %}&popup=1{% endif %}" class="marges user {% if popup %}js-oauth-popup{% endif %}">Confirmer suppression</a>
<a href="{% url 'fc-unlink' %}?next={{ next|urlencode }}{% if popup %}&popup=1{% endif %}" class="marges user {% if popup %}js-oauth-popup{% endif %}">Confirmer suppression</a>
<a href="{{ next }}" class="marges user bis">Annuler</a>
</p>
<br class="cb" />

View File

@ -0,0 +1,35 @@
{% load staticfiles %}
{% load sekizai_tags %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/screen.fc.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/oauth.js" %}"></script>{% endaddtoblock %}
{% comment %}
Emprunté sur caf.fr
{% endcomment %}
{% if 'nofc' not in request.GET %}
<div class="fc connecting">
<div class="cadre">
<div class="bordure">
<div class="marges">
<p class="flr">
<a href="{% url 'fc-login-or-link' %}{% if request.GET.next or popup %}?{% endif %}{% if request.GET.next %}{{ request.GET.urlencode }}{% endif %}{% if popup %}&popup=1{% endif %}"
title="Connectez-vous avec Mon Service Public" class="connexion{% if popup %} js-oauth-popup{% endif %}">Connexion</a>
</p>
<p>
<strong class="fz">
Nouveau&nbsp;: connectez-vous avec
<img src="{% static "authentic2_auth_fc/img/mon_service-public.fr_petit.png" %}" width="100" height="25" alt="mon.service-public.fr" />
</strong>
</p>
<p class="lien">
<a href="{% url "fc-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</div>
</div>
</div>
</div>
{% endif %}

View File

@ -4,7 +4,7 @@
<ul>
{% for document in documents %}
<li>
<a href="{% url 'msp-document' doc_id=document.id %}">{{ document.name }}</a>
<a href="{% url 'fc-document' doc_id=document.id %}">{{ document.name }}</a>
</li>
{% endfor %}
</ul>

View File

@ -5,10 +5,10 @@
{% block content %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/screen.msp.css' %}"></link>{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/msp.css' %}"></link>{% endaddtoblock %}
<div id="msp-link-management">
<div class="msp">
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/screen.fc.css' %}"></link>{% endaddtoblock %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/fc.css' %}"></link>{% endaddtoblock %}
<div id="fc-link-management">
<div class="fc">
<div class="cadre">
<div class="bordure">
<h1>Gestion des liaisons avec mon.service-public.fr</h1>
@ -52,8 +52,8 @@
</p>
<p>
<a href="{% url "msp-confirm-unlink" %}?next={{ next }}" class="marges user">Supprimer toutes les liaisons</a>
<img src="{% static "authentic2_auth_msp/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
<a href="{% url "fc-confirm-unlink" %}?next={{ next }}" class="marges user">Supprimer toutes les liaisons</a>
<img src="{% static "authentic2_auth_fc/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
</p>
</div>
<div class="menu">
@ -62,7 +62,7 @@
<h2>Qu&rsquo;est-ce que mon.service-public.fr&nbsp;?</h2>
<p> Simplifiez votre relation avec les services publics, acc&eacute;dez à une information adapt&eacute;e &agrave; votre cas personnel, r&eacute;alisez et suivez vos d&eacute;marches administratives en ligne. </p>
<p class="centrer">
<img src="{% static "authentic2_auth_msp/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
<img src="{% static "authentic2_auth_fc/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
</p>
<p class="lien">
<a href="https://mon.service-public.fr/portail/app/cms/public/a_propos_du_site" class="roll" target="_blank">En savoir plus</a>

View File

@ -0,0 +1,55 @@
{% load i18n %}
{% load sekizai_tags %}
{% load staticfiles %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/screen.fc.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_fc/js/oauth.js" %}"></script>{% endaddtoblock %}
<div id="fc-linking">
{% if user.is_authenticated and user.fcaccount and user.fcaccount.refresh_token %}
<div class="fc">
<div class="cadre">
<p class="centrer">
<img src="{% static "authentic2_auth_fc/img/toutes_vos_demarches.png" %}" width="140" height="35" alt="Vous &ecirc;tes actuellement en connexion avec" />
<img src="{% static "authentic2_auth_fc/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.Service-Public.fr" />
</p>
<ul class="fond">
<li class="picto">
<p class="lien">
<a href="{% url "fc-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</li>
<li class="picto utilisateur">
<p class="lien">
<a href="{% url "fc-link-management" %}?next={{ request.get_full_path|urlencode }}" class="roll">G&eacute;rer mes liaisons</a>
</p>
</li>
</ul>
</div>
</div>
{% else %}
<div class="fc" style="width: 300px">
<div class="cadre">
<p class="centrer">
<img src="{% static "authentic2_auth_fc/img/toutes_vos_demarches.png" %}" width="140" height="35" alt="Vous &ecirc;tes actuellement en connexion avec" />
<img src="{% static "authentic2_auth_fc/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
</p>
<ul class="fond">
<li class="picto">
<p class="lien">
<a href="{% url "fc-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</li>
<li class="picto utilisateur">
<p class="lien">
<a href="{% url 'fc-link' %}?next={{ request.get_full_path }}{% if popup %}&popup=1{% endif %}"
class="{% if popup %}js-oauth-popup{% endif %} roll db">Cr&eacute;er une liaison avec mon.service-public.fr</a>
</p>
</li>
</ul>
</div>
</div>
{% endif %}
</div>

View File

@ -0,0 +1 @@
{% include "authentic2_auth_fc/connecting.html" with popup=1 %}

View File

@ -5,8 +5,8 @@
{% block content %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/screen.msp.css' %}"></link>{% endaddtoblock %}
<div class="msp">
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_fc/css/screen.fc.css' %}"></link>{% endaddtoblock %}
<div class="fc">
<div class="cadre">
<div class="bordure">
<h1>Liaisons supprim&eacute;es&nbsp;!</h1>

View File

@ -0,0 +1,25 @@
from django.conf.urls import patterns, url, include
from . import views
fcpatterns = patterns('',
url(r'^login/$', views.login, name='fc-login'),
url(r'^link/$', views.link, name='fc-link'),
url(r'^login-or-link/$', views.login_or_link, name='fc-login-or-link'),
url(r'^link-management/$', views.link_management,
name='fc-link-management'),
url(r'^link-management/unlink/confirm/$', views.confirm_unlink,
name='fc-confirm-unlink'),
url(r'^link-management/unlink/done/$', views.unlink_done,
name='fc-unlink-done'),
url(r'^link-management/unlink/$', views.unlink, name='fc-unlink'),
url(r'^authorize/$', views.authorize, name='fc-authorize'),
url(r'^access_token/$', views.access_token, name='fc-access-token'),
url(r'^documents/$', views.documents, name='fc-documents'),
url(r'^documents/(?P<doc_id>[^/]*)/$', views.document,
name='fc-document'),
)
urlpatterns = patterns('',
url(r'^fc/', include(fcpatterns)),
)

View File

@ -30,15 +30,15 @@ from django.views.decorators.clickjacking import xframe_options_exempt
from . import app_settings, models
def user_has_mspaccount(user):
'''Return True if user a link to MSP'''
def user_has_fcaccount(user):
'''Return True if user a link to FC'''
try:
return user.mspaccount is not None
except models.MspAccount.DoesNotExist:
return user.fcaccount is not None
except models.FcAccount.DoesNotExist:
return False
mspaccount_required = user_passes_test(user_has_mspaccount, '/')
fcaccount_required = user_passes_test(user_has_fcaccount, '/')
class LoggerMixin(object):
def __init__(self, *args, **kwargs):
@ -46,7 +46,7 @@ class LoggerMixin(object):
super(LoggerMixin, *args, **kwargs)
try:
cache = get_cache('msp')
cache = get_cache('fc')
except InvalidCacheBackendError:
cache = get_cache('default')
@ -81,8 +81,7 @@ def resolve_access_token(authorization_code, redirect_uri):
'grant_type': 'authorization_code',
}
response = requests.post(app_settings.token_url,
data=data, verify=app_settings.verify_certificate,
cert=app_settings.client_certificate)
data=data, verify=app_settings.verify_certificate)
return response.json()
@ -102,7 +101,7 @@ def access_token_from_request(request):
ACCESS_GRANT_CODE = 'accessgrantcode'
class MspOAuthSessionViewMixin(LoggerMixin):
class FcOAuthSessionViewMixin(LoggerMixin):
'''Add the OAuth2 dance to a view'''
scopes = []
redirect_field_name = REDIRECT_FIELD_NAME
@ -122,7 +121,7 @@ class MspOAuthSessionViewMixin(LoggerMixin):
'''Show a page to close the current popup and reload the parent window
with the return url.
'''
return render(request, 'authentic2_auth_msp/close-popup-redirect.html', {'redirect_to': next_url})
return render(request, 'authentic2_auth_fc/close-popup-redirect.html', {'redirect_to': next_url})
def simple_redirect(self, request, next_url, *args, **kwargs):
return HttpResponseRedirect(next_url)
@ -148,11 +147,10 @@ class MspOAuthSessionViewMixin(LoggerMixin):
def get_scopes(self):
return self.scopes
def api_call(self, api_path, method='get', **kwargs):
url = urlparse.urljoin(app_settings.api_url, api_path)
return getattr(self.oauth_session(), method)(url,
verify=app_settings.verify_certificate,
cert=app_settings.client_certificate, **kwargs)
def get_user_info(self):
return self.oauth_session().get(
app_settings.userinfo_url + '?schema=openid',
verify=app_settings.verify_certificate).json()
def authorization_error(self, request, *args, **kwargs):
if request.REQUEST['error'] == 'access_denied':
@ -164,9 +162,13 @@ class MspOAuthSessionViewMixin(LoggerMixin):
'''Interpret the OAuth authorization dance'''
if 'code' in request.GET:
self.token = access_token_from_request(request)
self.id_token_raw = self.token['id_token']
self.id_token = json.loads(self.id_token_raw.split('.')[1])
for key in self.id_token:
setattr(self, key, seld.id_token[key])
self.oauth_session = lambda: OAuth2Session(
app_settings.client_id, token=self.token)
return super(MspOAuthSessionViewMixin, self).dispatch(request, *args, **kwargs)
return super(FcOAuthSessionViewMixin, self).dispatch(request, *args, **kwargs)
elif 'error' in request.GET:
return self.authorization_error(request, *args, **kwargs)
else:
@ -176,8 +178,8 @@ class PopupViewMixin(object):
def get_in_popup(self):
return 'popup' in self.request.REQUEST
class LoginView(PopupViewMixin, MspOAuthSessionViewMixin, View):
'''Authenticate an user with MSP'''
class LoginView(PopupViewMixin, FcOAuthSessionViewMixin, View):
'''Authenticate an user with FC'''
scopes = [ 'GET_AGC', 'DELETE_AGC' ]
def dispatch(self, request, *args, **kwargs):
@ -186,21 +188,20 @@ class LoginView(PopupViewMixin, MspOAuthSessionViewMixin, View):
return super(LoginView, self).dispatch(request, *args, **kwargs)
def get(self, request, *args, **kwargs):
result = self.api_call('app/rest/agc').json()
agc = result[ACCESS_GRANT_CODE]
user = authenticate(agc=agc)
user_info = self.get_user_info()
user = authenticate(sub=self.sub, user_info=user_info)
if user:
auth_login(request, user)
self.logger.info('user %r logged in using msp', unicode(user))
self.logger.info('user %r logged in using fc', unicode(user))
else:
messages.warning(request, _('no local account is linked to your MSP '
messages.warning(request, _('no local account is linked to your FC '
'account'))
return self.redirect(request)
login = LoginView.as_view()
class LinkView(PopupViewMixin, MspOAuthSessionViewMixin, View):
'''Link current user to its MSP account'''
class LinkView(PopupViewMixin, FcOAuthSessionViewMixin, View):
'''Link current user to its FC account'''
scopes = [ 'GET_AGC', 'DELETE_AGC' ]
def dispatch(self, request, *args, **kwargs):
@ -214,46 +215,46 @@ class LinkView(PopupViewMixin, MspOAuthSessionViewMixin, View):
result = self.api_call('app/rest/agc').json()
agc = result[ACCESS_GRANT_CODE]
try:
models.MspAccount.objects.get(agc=agc)
messages.info(request, _('msp link already exists'))
except models.MspAccount.DoesNotExist:
models.MspAccount.objects.create(user=request.user,
models.FcAccount.objects.get(agc=agc)
messages.info(request, _('fc link already exists'))
except models.FcAccount.DoesNotExist:
models.FcAccount.objects.create(user=request.user,
agc=agc, token=json.dumps(self.token))
self.logger.info('msp link created for user %r',
self.logger.info('fc link created for user %r',
unicode(request.user))
messages.info(request, _('msp link created'))
messages.info(request, _('fc link created'))
return self.redirect(request)
link = LinkView.as_view()
class UnlinkView(PopupViewMixin, MspOAuthSessionViewMixin, TemplateView):
'''Delete link with user MSP account'''
class UnlinkView(PopupViewMixin, FcOAuthSessionViewMixin, TemplateView):
'''Delete link with user FC account'''
scopes = [ 'DELETE_AGC' ]
def get(self, request, *args, **kwargs):
qs = models.MspAccount.objects.filter(user=request.user)
qs = models.FcAccount.objects.filter(user=request.user)
if qs.exists():
result = self.api_call('app/rest/agc', method='delete')
if result.status_code // 100 == 2:
qs.delete()
self.logger.info('msp link deleted for %r', unicode(request.user))
self.logger.info('fc link deleted for %r', unicode(request.user))
next_url = self.redirect_to(request, *args, **kwargs)
msp_unlink_url = reverse('msp-unlink-done')
next_url = '{0}?{1}'.format(msp_unlink_url,
fc_unlink_url = reverse('fc-unlink-done')
next_url = '{0}?{1}'.format(fc_unlink_url,
urllib.urlencode({REDIRECT_FIELD_NAME: next_url}))
return self.redirect(request, next_url=next_url)
else:
self.logger.debug('error when deleting msp link %r', result.content)
self.logger.debug('error when deleting fc link %r', result.content)
else:
self.logger.debug('no msp account exist doing nothing')
self.logger.debug('no fc account exist doing nothing')
return self.redirect(request)
unlink = login_required(UnlinkView.as_view())
class AuthorizeView(LoggerMixin, View):
'''OAuth2/MSP proxy authorization view.
'''OAuth2/FC proxy authorization view.
It works exactly like MSP authorization endpoint but hide the real
It works exactly like FC authorization endpoint but hide the real
access token and allocate a pseudonym instead.
'''
def get(self, request, *args, **kwargs):
@ -261,13 +262,13 @@ class AuthorizeView(LoggerMixin, View):
if 'code' in GET:
assert 'state' in GET
state = GET['state']
saved = cache.get('msp-state-' + state)
saved = cache.get('fc-state-' + state)
redirect_uri = saved['redirect_uri']
old_state = saved['state']
new_code = str(uuid.uuid4())
cache.set('msp-code-' + new_code, {
'msp_code': GET['code'],
'msp_redirect_uri': request.build_absolute_uri(request.path),
cache.set('fc-code-' + new_code, {
'fc_code': GET['code'],
'fc_redirect_uri': request.build_absolute_uri(request.path),
'redirect_uri': redirect_uri,
'scope': saved['scope'],
}, CACHE_TIMEOUT)
@ -285,7 +286,7 @@ class AuthorizeView(LoggerMixin, View):
if 'error' in GET:
assert 'state' in GET
state = GET['state']
saved = cache.get('msp-state-' + state)
saved = cache.get('fc-state-' + state)
old_state = saved['state']
redirect_uri = saved['redirect_uri']
parsed = urlparse.urlparse(redirect_uri)
@ -305,10 +306,10 @@ class AuthorizeView(LoggerMixin, View):
assert GET['response_type'] == 'code'
redirect_uri = request.build_absolute_uri(request.path)
state = str(uuid.uuid4())
self.logger.debug('%s: received MSP authorization demande %r', state, GET)
self.logger.debug('%s: received FC authorization demande %r', state, GET)
# save state
cache.set('msp-state-' + state, {
'msp_redirect_uri': redirect_uri,
cache.set('fc-state-' + state, {
'fc_redirect_uri': redirect_uri,
'scope': GET['scope'].split(),
'redirect_uri': GET['redirect_uri'],
'state': GET.get('state')
@ -325,9 +326,9 @@ class AuthorizeView(LoggerMixin, View):
authorize = xframe_options_exempt(AuthorizeView.as_view())
class AccessToken(View):
'''OAuth2/MSP proxy access token view.
'''OAuth2/FC proxy access token view.
It works exactly like MSP authorization endpoint but hide the real
It works exactly like FC authorization endpoint but hide the real
access token and allocate a pseudonym instead.
'''
def post(self, request, *args, **kwargs):
@ -354,14 +355,14 @@ class AccessToken(View):
assert (client_id, client_secret) in app_settings.client_credentials
code = request.POST['code']
redirect_uri = request.POST['redirect_uri']
state = cache.get('msp-code-' + code)
state = cache.get('fc-code-' + code)
assert state is not None
assert 'redirect_uri' in state
assert state['redirect_uri'] == redirect_uri
result = resolve_access_token(state['msp_code'], state['msp_redirect_uri'])
result = resolve_access_token(state['fc_code'], state['fc_redirect_uri'])
if 'access_token' in result:
token = str(uuid.uuid4())
cache.set('msp-access-token-' + token, {
cache.set('fc-access-token-' + token, {
'token': result,
'scope': state['scope'],
}, CACHE_TIMEOUT)
@ -392,7 +393,7 @@ class BearerTokenUnauthorized(HttpResponse):
class OAuth2ProxyView(View):
'''Base class to implement proxy view toward MSP resource endpoints
'''Base class to implement proxy view toward FC resource endpoints
protected by OAuth2 bearer authentication'''
def dispatch(self, request, *args, **kwargs):
# enforce Bearer authentication
@ -404,7 +405,7 @@ class OAuth2ProxyView(View):
assert len(l) == 2
assert l[0] == 'Bearer'
access_token = base64.b64decode(l[1])
state = cache.get('msp-access-token-' + access_token)
state = cache.get('fc-access-token-' + access_token)
if not (set(self.scopes) <= set(state['scope'])):
return BearerTokenUnauthorized('insufficient_scope')
assert 'token' in state
@ -418,11 +419,11 @@ class OAuth2ProxyView(View):
url = urlparse.urljoin(app_settings.api_url, api_path)
return getattr(self.oauth_session, method)(url,
verify=app_settings.verify_certificate,
cert=app_settings.client_certificate, **kwargs)
**kwargs)
class DocumentsView(OAuth2ProxyView):
'''Proxy to the list of documents resource of MSP'''
'''Proxy to the list of documents resource of FC'''
scopes = [ 'LIST_DOCS' ]
def get(self, request, *args, **kwargs):
@ -434,7 +435,7 @@ documents = DocumentsView.as_view()
class DocumentView(OAuth2ProxyView):
'''Proxy to the document resource of MSP'''
'''Proxy to the document resource of FC'''
scopes = [ 'GET_DOC' ]
def get(self, request, *args, **kwargs):
@ -445,8 +446,8 @@ class DocumentView(OAuth2ProxyView):
document = DocumentView.as_view()
class LoginOrLinkView(PopupViewMixin, MspOAuthSessionViewMixin, View):
'''Login with MSP, if the MSP account is already linked, connect this user,
class LoginOrLinkView(PopupViewMixin, FcOAuthSessionViewMixin, View):
'''Login with FC, if the FC account is already linked, connect this user,
if a user is logged link the user to this account, otherwise display an
error message.
'''
@ -459,36 +460,36 @@ class LoginOrLinkView(PopupViewMixin, MspOAuthSessionViewMixin, View):
user = authenticate(agc=agc)
if user:
auth_login(request, user)
self.logger.info('user %r logged in using msp', unicode(user))
self.logger.info('user %r logged in using fc', unicode(user))
return self.redirect(request)
elif request.user.is_authenticated():
# Old link are deleted
msp_account, created = models.MspAccount.objects.get_or_create(defaults={
fc_account, created = models.FcAccount.objects.get_or_create(defaults={
'agc': agc,
'token': json.dumps(self.token),
}, user=request.user)
for old_msp_account in models.MspAccount.objects \
.exclude(pk=msp_account.pk) \
for old_fc_account in models.FcAccount.objects \
.exclude(pk=fc_account.pk) \
.filter(agc=agc):
old_msp_account.delete()
self.logger.info('msp link deleted for user %r',
old_fc_account.delete()
self.logger.info('fc link deleted for user %r',
unicode(request.user))
if not created:
# Previous links is replaced
if msp_account.agc != agc:
msp_account.agc = agc
self.logger.info('msp link changed for user %r',
if fc_account.agc != agc:
fc_account.agc = agc
self.logger.info('fc link changed for user %r',
unicode(request.user))
msp_account.token = json.dumps(self.token)
msp_account.save()
fc_account.token = json.dumps(self.token)
fc_account.save()
else:
self.logger.info('msp link created for user %r',
self.logger.info('fc link created for user %r',
unicode(request.user))
messages.info(request, _('msp link created'))
messages.info(request, _('fc link created'))
return self.redirect(request)
else:
messages.info(request, _('to create a link with msp, please authenticate'))
return self.redirect_and_come_back(request, '{0}?nomsp=1'.format(settings.LOGIN_URL))
messages.info(request, _('to create a link with fc, please authenticate'))
return self.redirect_and_come_back(request, '{0}?nofc=1'.format(settings.LOGIN_URL))
login_or_link = LoginOrLinkView.as_view()
@ -502,31 +503,24 @@ class TemplateWithNextUrlView(TemplateView):
return ctx
class LinkManagementView(TemplateWithNextUrlView):
template_name = 'authentic2_auth_msp/link_management.html'
template_name = 'authentic2_auth_fc/link_management.html'
link_management = mspaccount_required(LinkManagementView.as_view())
link_management = fcaccount_required(LinkManagementView.as_view())
link_management = login_required(link_management)
class ConfirmUnlinkView(TemplateWithNextUrlView):
template_name = 'authentic2_auth_msp/confirm_unlink.html'
template_name = 'authentic2_auth_fc/confirm_unlink.html'
def get_context_data(self, **kwargs):
ctx = super(ConfirmUnlinkView, self).get_context_data(**kwargs)
ctx['popup'] = True
return ctx
confirm_unlink = mspaccount_required(ConfirmUnlinkView.as_view())
confirm_unlink = fcaccount_required(ConfirmUnlinkView.as_view())
confirm_unlink = login_required(confirm_unlink)
class UnlinkDoneView(TemplateWithNextUrlView):
template_name = 'authentic2_auth_msp/unlink_done.html'
template_name = 'authentic2_auth_fc/unlink_done.html'
unlink_done = UnlinkDoneView.as_view()
class MoreRedirectView(RedirectView):
def get_redirect_url(self, *args, **kwargs):
return app_settings.more_url
more_redirect = MoreRedirectView.as_view()

View File

@ -1,339 +0,0 @@
.msp{
margin:0 auto 0 auto;
text-align:left;
font-size:11px;
position:relative;
padding:0 0 0px 0;
color:#2B2A91;
font-family:arial, verdana, sans-serif;
}
.msp *{
font-family:arial, verdana, sans-serif;
font-size:100%;
}
.msp p, .msp form, .msp h1, .msp h2, .msp h3, .msp h4, .msp h5, .msp h6, .msp input{
margin:0;
font-weight:normal;
}
.msp ul, .msp ol{
list-style-type:none;
padding:0;
margin:0;
}
* html .msp li{
height:1%;
}
.msp fieldset{
background:#dae7ef url(../img/bg/degrade.jpg) left 0 repeat-x;
border:1px solid #2B2A91;
margin:0;
padding:0;
}
.msp img{width:auto!important}
.msp a img{border:none}
.msp .alc{text-align:center}
.msp .db{display:block}
.msp .cb {clear:both}
.msp .flr{float:right!important}
.msp .m30 {margin:30px}
.msp .mb20 {margin-bottom:20px}
.msp .fz {font-size:110%}
.msp .fz2 {font-size:130%}
.msp .fz3 {font-size:105%!important}
.msp .bnone {border:none!important}
.msp .fz2 a {font-weight:bold}
.msp p{margin:0 0 0.5em 0;padding:0}
.msp a{background-color:inherit;color:#31579C!important}
.msp a.roll,.msp a.none{text-decoration:none!important}
.msp a.roll:hover{text-decoration:underline!important}
.msp .bordure{border:2px solid #FFF;position:relative}
* html .msp .bordure {height:1%}
*:first-child+html .msp .bordure {min-height:1%}
.msp .bordure:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.msp .marges{padding:0.4em}
.msp fieldset .marges{padding:0 1em 0 1.25em}
.msp fieldset .marges.top {padding-top:1em}
.msp fieldset legend{background-color:#FFF;color:#2B2A91;margin-left:0.5em}
.msp fieldset legend span{display:block;font-size:130%;font-weight:700;padding:0 0.5em 1em;position:relative;top:0.5em}
.msp p img{vertical-align:middle}
.msp p input.checkbox{vertical-align:middle}
.msp p.lien{text-align:right}
.msp p.lien a{background:url(../img/bg/fleche.png) 0 4px no-repeat;padding-left:12px}
.msp label{cursor:pointer;font-weight:700}
.msp .cadre{background:#FFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.msp .centrer{text-align:center}
.msp .centrer img{display:block;width:150px;margin:0 auto}
.msp li .lien{text-align:left !important}
.msp li.picto{background-position:2px 2px;background-repeat:no-repeat;padding-left:20px}
.msp li.utilisateur{background-image:url(../img/bg/utilisateur.png)}
.msp li.fermer{background-image:url(../img/bg/fermer.png)}
.msp .message{background-color:#E7E7F7;border-left:10px solid #B5CEEE;color:#000;padding:1em}
* html .msp .message{height:1%}
.msp .message p{margin:0}
.msp .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.msp .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF!important}
.msp small a{background-color:inherit;background-image:url(../img/bg/retour.png);background-position:0 50%;background-repeat:no-repeat;color:#000;float:right;margin-right:30px;margin-top:-2em;padding-left:20px;font-size:90%}
.msp h1{background-color:inherit;color:#31579C;font-size:200%;margin:0.5em 0 0.5em 30px;padding:0;font-weight:bold}
.msp .contenu{background-color:inherit;color:#000;display:inline;float:left;margin-left:30px;padding-bottom:2em;width:445px}
.msp .menu{background-color:inherit;color:#000;display:inline;float:left;margin:0 30px;padding-bottom:2em;width:215px}
.msp .retablir{clear:both;display:block;height:1px;margin-top:-1px;overflow:hidden;width:1px}
.msp .encart{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x ;border:1px solid #2B2A91}
.msp .encart h2{background-color:#5E81C1;color:#FFF;font-size:100%;font-weight:bold;margin:0;padding:1px 6px}
.msp .encart p{margin:1em}
.msp .contenu ul{margin:2em 0}
.msp .contenu li.utilisateur{background-image:url(../img/bg/utilisateur_blanc.png)}
.msp .important{background-color:#E1E9F8;color:inherit;margin-bottom:0.5em;padding:0.5em}
.msp .important p{margin:0;padding:0;font-weight:bold}
.msp .contenu li p{padding:0}
.msp a.marges{margin-right:20px;padding:0}
.msp .barre{border-left:10px solid #B5CEEE;font-weight:bold;padding-left:20px}
.msp .barre ul{font-weight:400}
.msp em{background-color:inherit;color:#31579C;display:block;font-weight:700;margin:1.5em 0;text-align:center}
.msp .contenu ul strong{background-image:url(../img/bg/fleche.png);background-position:0 4px;background-repeat:no-repeat;padding-left:15px}
.msp .connexion{font-weight:bold;color:#FFF!important;background-color:inherit!important;text-decoration:none!important;background-image:url(../img/bg/connect.png);background-position:100% 50%;padding:0 25px 0 15px;text-transform:uppercase;font-size:120%}
.msp .fond li.central {padding:0 0.5em 1em;text-align:center}
.msp .note,.msp .joindre{background:#010d23 url(../img/bg/note2.gif) 0 0 repeat-x}
.msp .note span,.msp .joindre span{background:url(../img/bg/note.png) 0 0 no-repeat;display:block;padding:4px 5px 4px 20px;min-height:14px;font-weight:bold}
.msp .joindre span{background-image:url(../img/bg/note.png)}
* html .msp .note span,* html .msp .joindre span{height:14px;}
.msp .note a,.msp .joindre a{color:#FFF!important;text-decoration:none}
.msp .user{background:#2b5973 url(../img/bg/user_2.png) top left no-repeat ;padding:3px 10px 3px 18px!important;float:left;display:inline;color:#FFF!important;font-weight:bold;text-decoration:none}
.msp .bis{background-image:url(../img/bg/user.png);color:#1A2D4E!important;background-color:inherit;border:1px solid #C4D7DF;padding:2px 10px 2px 18px!important}
.msp.bloc {width:99%;border:1px solid #31579C}
.msp .cadre{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.msp .centrer{text-align:center}
.msp .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.msp .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF}
/* en savoir plus */
.msp_esp{
font-family:arial, verdana, sans-serif;
background:#FFF;
margin:24px 0 40px 19px;
border:1px solid #4b4da4;
width:712px;
padding:0 0 55px 0;
font-size:11px;
text-align:left;
position:relative;
}
.msp_esp *{
font-family:arial, verdana, sans-serif;
font-size:100%;
color:#434343;
}
.msp_esp p, .msp_esp h1, .msp_esp h2, .msp_esp h3, .msp_esp form{
margin:0;
font-weight:normal;
}
.msp_esp_h{
position:absolute;
left:4px;
top:4px;
width:704px;
height:213px;
background:url(../img/fond_ensavoirplus_h.jpg) 0 0 no-repeat;
}
.msp_esp_b{
position:absolute;
left:4px;
bottom:4px;
width:704px;
height:55px;
background:url(../img/fond_ensavoirplus_b.jpg) 0 0 repeat-x;
}
.msp_esp_header{
margin:0 0 -6px 0;
}
.msp_esp_header:after{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
* html .msp_esp_header{
height:1%;
}
*:first-child+html .msp_esp_header{
min-height:1%;
}
.msp_esp_intro{
position:relative;
padding:0 0 0 20px;
float:left;
width:548px;
}
* html .msp_esp_intro{
width:558px;
}
.msp_esp_header a,
.msp_esp_header a:hover{
position:relative;
float:left;
background:url(../img/visite_guidee.png) 0 0 no-repeat;
display:block;
width:125px;
height:122px;
margin:30px 0 0 0;
overflow:hidden;
text-indent:-999em;
cursor:pointer;
cursor:hand;
}
* html .msp_esp_header a{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/visite_guidee.png',sizingMethod='crop');
}
.msp_esp_pgtitre{
color:#31579c;
font-size:150%;
text-transform:uppercase;
padding:30px 0 10px 0;
}
.msp_esp_pgtitre span{
color:#31579c;
font-size:210%;
line-height:90%;
}
.msp_esp_intro p{
font-size:110%;
line-height:150%;
font-weight:bold;
padding:0 10px 0 0;
}
.msp_esp_cont{
margin:0 12px 0 12px;
position:relative;
padding:24px 0 24px 0;
}
* html .msp_esp_cont{
height:1%;
}
*:first-child+html .msp_esp_cont{
min-height:1%;
}
.msp_esp_cont-h{
position:absolute;
top:0;
left:0;
width:680px;
height:24px;
background:url(../img/ombre_content_h.png) 0 0 no-repeat;
}
* html .msp_esp_cont-h{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_h.png',sizingMethod='crop');
}
.msp_esp_cont-b{
position:absolute;
bottom:0;
left:0;
width:688px;
height:24px;
background:url(../img/ombre_content_b.png) 0 0 no-repeat;
}
* html .msp_esp_cont-b{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_b.png',sizingMethod='crop');
}
.msp_esp_cont-m{
background:url(../img/ombre_content_m.png) 0 0 repeat-y;
padding:0 14px 0 14px;
}
* html .msp_esp_cont-m{
height:1%;
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_m.png',sizingMethod='scale');
}
.msp_esp_pres .msp_esp_sub,
.msp_esp_sub{
text-align:center;
padding:0 0 4px 0;
min-height:1px;
font-size:100%;
}
* html .msp_esp_pres div .msp_esp_sub{
height:auto;
}
.msp_esp_sub a,
.msp_esp_sub a:hover{
display:-moz-inline-box;
background:#010D23 url(../img/bk-input.gif) 0 0 repeat-x;
color:#fff;
border:none;
padding:3px 60px;
text-transform:uppercase;
font-weight:bold;
cursor:pointer;
cursor:hand;
text-decoration:none;
min-height:22px;
}
* html .msp_esp_sub a{
display:inline-block;
height:16px;
}
*:first-child+html .msp_esp_sub a{
display:inline-block;
min-height:16px;
}
.msp_esp_cont-degh{
background:url(../img/deg_content_h.png) 0 0 repeat-x;
}
.msp_esp_cont-degb{
background:url(../img/deg_content_b.png) 0 100% repeat-x;
padding:0 8px 0 8px;
}
.msp_esp_cont-m .msp_esp_btitre{
padding:4px 0 5px 0;
color:#31579c;
font-weight:bold;
font-size:120%;
}
.msp_esp_pres div p{
padding:6px 12px 20px 188px;
font-size:110%;
min-height:83px;
}
* html .msp_esp_pres .msp_esp_cont-degb div p{
height:83px;
}
.msp_esp_pres .msp_esp_btitre{
color:#fff;
padding:4px 10px 5px 10px;
}
.msp_esp_bloc1 .msp_esp_btitre{
background:#143152 url(../img/fond_titre_1.png) 0 0 repeat-x;
}
.msp_esp_bloc1 p{
background:url(../img/illus_1.jpg) 0 0 no-repeat;
}
.msp_esp_bloc2 .msp_esp_btitre{
background:#386722 url(../img/fond_titre_2.png) 0 0 repeat-x;
}
.msp_esp_bloc2 p{
background:url(../img/illus_2.jpg) 0 0 no-repeat;
}
.msp_esp_bloc3 .msp_esp_btitre{
background:#815302 url(../img/fond_titre_3.png) 0 0 repeat-x;
}
.msp_esp_bloc3 p{
background:url(../img/illus_3.jpg) 0 0 no-repeat;
}
.msp_esp_bloc4 .msp_esp_btitre{
background:#862e78 url(../img/fond_titre_4.png) 0 0 repeat-x;
}
.msp_esp_bloc4 p{
background:url(../img/illus_4.jpg) 0 0 no-repeat;
}
.msp_esp_logos {
text-align:center;
list-style-type:none;
padding:0;
margin:12px 0 4px 0;
}
.msp_esp_logos li{
display:inline;
margin:0 8px 0 3px;
}

View File

@ -1,3 +0,0 @@
#msp-link-management, #msp-confirm-unlink {
margin-top: 15px;
}

View File

@ -1,347 +0,0 @@
#msp-linking {
margin: 0px 100px;
}
.msp{
margin:0 auto 0 auto;
text-align:left;
font-size:11px;
position:relative;
padding:0 0 0px 0;
color:#2B2A91;
font-family:arial, verdana, sans-serif;
}
.msp.connecting {
width: 35em;
}
.msp *{
font-family:arial, verdana, sans-serif;
font-size:100%;
}
.msp p, .msp form, .msp h1, .msp h2, .msp h3, .msp h4, .msp h5, .msp h6, .msp input{
margin:0;
font-weight:normal;
}
.msp ul, .msp ol{
list-style-type:none;
padding:0;
margin:0;
}
* html .msp li{
height:1%;
}
.msp fieldset{
background:#dae7ef url(../img/bg/degrade.jpg) left 0 repeat-x;
border:1px solid #2B2A91;
margin:0;
padding:0;
}
.msp img{width:auto!important}
.msp a img{border:none}
.msp .alc{text-align:center}
.msp .db{display:block}
.msp .cb {clear:both}
.msp .flr{float:right!important}
.msp .m30 {margin:30px}
.msp .mb20 {margin-bottom:20px}
.msp .fz {font-size:110%}
.msp .fz2 {font-size:130%}
.msp .fz3 {font-size:105%!important}
.msp .bnone {border:none!important}
.msp .fz2 a {font-weight:bold}
.msp p{margin:0 0 0.5em 0;padding:0}
.msp a{background-color:inherit;color:#31579C!important}
.msp a.roll,.msp a.none{text-decoration:none!important}
.msp a.roll:hover{text-decoration:underline!important}
.msp .bordure{border:2px solid #FFF;position:relative}
* html .msp .bordure {height:1%}
*:first-child+html .msp .bordure {min-height:1%}
.msp .bordure:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.msp .marges{padding:0.4em}
.msp fieldset .marges{padding:0 1em 0 1.25em}
.msp fieldset .marges.top {padding-top:1em}
.msp fieldset legend{background-color:#FFF;color:#2B2A91;margin-left:0.5em}
.msp fieldset legend span{display:block;font-size:130%;font-weight:700;padding:0 0.5em 1em;position:relative;top:0.5em}
.msp p img{vertical-align:middle}
.msp p input.checkbox{vertical-align:middle}
.msp p.lien{text-align:right}
.msp p.lien a{background:url(../img/bg/fleche.png) 0 4px no-repeat;padding-left:12px}
.msp label{cursor:pointer;font-weight:700}
.msp .cadre{background:#FFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.msp .centrer{text-align:center}
.msp .centrer img{display:block;width:150px;margin:0 auto}
.msp li .lien{text-align:left !important}
.msp li.picto{background-position:2px 2px;background-repeat:no-repeat;padding-left:20px}
.msp li.utilisateur{background-image:url(../img/bg/utilisateur.png)}
.msp li.fermer{background-image:url(../img/bg/fermer.png)}
.msp .message{background-color:#E7E7F7;border-left:10px solid #B5CEEE;color:#000;padding:1em}
* html .msp .message{height:1%}
.msp .message p{margin:0}
.msp .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.msp .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF!important}
.msp small a{background-color:inherit;background-image:url(../img/bg/retour.png);background-position:0 50%;background-repeat:no-repeat;color:#000;float:right;margin-right:30px;margin-top:-2em;padding-left:20px;font-size:90%}
.msp h1{background-color:inherit;color:#31579C;font-size:200%;margin:0.5em 0 0.5em 30px;padding:0;font-weight:bold}
.msp .contenu{background-color:inherit;color:#000;display:inline;float:left;margin-left:30px;padding-bottom:2em;width:445px}
.msp .menu{background-color:inherit;color:#000;display:inline;float:left;margin:0 30px;padding-bottom:2em;width:215px}
.msp .retablir{clear:both;display:block;height:1px;margin-top:-1px;overflow:hidden;width:1px}
.msp .encart{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x ;border:1px solid #2B2A91}
.msp .encart h2{background-color:#5E81C1;color:#FFF;font-size:100%;font-weight:bold;margin:0;padding:1px 6px}
.msp .encart p{margin:1em}
.msp .contenu ul{margin:2em 0}
.msp .contenu li.utilisateur{background-image:url(../img/bg/utilisateur_blanc.png)}
.msp .important{background-color:#E1E9F8;color:inherit;margin-bottom:0.5em;padding:0.5em}
.msp .important p{margin:0;padding:0;font-weight:bold}
.msp .contenu li p{padding:0}
.msp a.marges{margin-right:20px;padding:0}
.msp .barre{border-left:10px solid #B5CEEE;font-weight:bold;padding-left:20px}
.msp .barre ul{font-weight:400}
.msp em{background-color:inherit;color:#31579C;display:block;font-weight:700;margin:1.5em 0;text-align:center}
.msp .contenu ul strong{background-image:url(../img/bg/fleche.png);background-position:0 4px;background-repeat:no-repeat;padding-left:15px}
.msp .connexion{font-weight:bold;color:#FFF!important;background-color:inherit!important;text-decoration:none!important;background-image:url(../img/bg/connect.png);background-position:100% 50%;padding:0 25px 0 15px;text-transform:uppercase;font-size:120%}
.msp .fond li.central {padding:0 0.5em 1em;text-align:center}
.msp .note,.msp .joindre{background:#010d23 url(../img/bg/note2.gif) 0 0 repeat-x}
.msp .note span,.msp .joindre span{background:url(../img/bg/note.png) 0 0 no-repeat;display:block;padding:4px 5px 4px 20px;min-height:14px;font-weight:bold}
.msp .joindre span{background-image:url(../img/bg/note.png)}
* html .msp .note span,* html .msp .joindre span{height:14px;}
.msp .note a,.msp .joindre a{color:#FFF!important;text-decoration:none}
.msp .user{background:#2b5973 url(../img/bg/user_2.png) top left no-repeat ;padding:3px 10px 3px 18px!important;float:left;display:inline;color:#FFF!important;font-weight:bold;text-decoration:none}
.msp .bis{background-image:url(../img/bg/user.png);color:#1A2D4E!important;background-color:inherit;border:1px solid #C4D7DF;padding:2px 10px 2px 18px!important}
.msp.bloc {width:99%;border:1px solid #31579C}
.msp .cadre{background:#FFFFFF url(../img/bg/degrade.jpg) left bottom repeat-x;border:1px solid #2B2A91}
.msp .centrer{text-align:center}
.msp .fond{background-color:#838BCE;background-image:url(../img/bg/coin.png);background-position:100% 100%;background-repeat:no-repeat;color:#FFF;padding:1em 3px}
.msp .fond a{background-color:inherit;background-image:url(../img/bg/fleche_blanche.png) !important;color:#FFF}
/* en savoir plus */
.msp_esp{
font-family:arial, verdana, sans-serif;
background:#FFF;
margin:24px 0 40px 19px;
border:1px solid #4b4da4;
width:712px;
padding:0 0 55px 0;
font-size:11px;
text-align:left;
position:relative;
}
.msp_esp *{
font-family:arial, verdana, sans-serif;
font-size:100%;
color:#434343;
}
.msp_esp p, .msp_esp h1, .msp_esp h2, .msp_esp h3, .msp_esp form{
margin:0;
font-weight:normal;
}
.msp_esp_h{
position:absolute;
left:4px;
top:4px;
width:704px;
height:213px;
background:url(../img/fond_ensavoirplus_h.jpg) 0 0 no-repeat;
}
.msp_esp_b{
position:absolute;
left:4px;
bottom:4px;
width:704px;
height:55px;
background:url(../img/fond_ensavoirplus_b.jpg) 0 0 repeat-x;
}
.msp_esp_header{
margin:0 0 -6px 0;
}
.msp_esp_header:after{
content:".";
display:block;
height:0;
clear:both;
visibility:hidden;
}
* html .msp_esp_header{
height:1%;
}
*:first-child+html .msp_esp_header{
min-height:1%;
}
.msp_esp_intro{
position:relative;
padding:0 0 0 20px;
float:left;
width:548px;
}
* html .msp_esp_intro{
width:558px;
}
.msp_esp_header a,
.msp_esp_header a:hover{
position:relative;
float:left;
background:url(../img/visite_guidee.png) 0 0 no-repeat;
display:block;
width:125px;
height:122px;
margin:30px 0 0 0;
overflow:hidden;
text-indent:-999em;
cursor:pointer;
cursor:hand;
}
* html .msp_esp_header a{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/visite_guidee.png',sizingMethod='crop');
}
.msp_esp_pgtitre{
color:#31579c;
font-size:150%;
text-transform:uppercase;
padding:30px 0 10px 0;
}
.msp_esp_pgtitre span{
color:#31579c;
font-size:210%;
line-height:90%;
}
.msp_esp_intro p{
font-size:110%;
line-height:150%;
font-weight:bold;
padding:0 10px 0 0;
}
.msp_esp_cont{
margin:0 12px 0 12px;
position:relative;
padding:24px 0 24px 0;
}
* html .msp_esp_cont{
height:1%;
}
*:first-child+html .msp_esp_cont{
min-height:1%;
}
.msp_esp_cont-h{
position:absolute;
top:0;
left:0;
width:680px;
height:24px;
background:url(../img/ombre_content_h.png) 0 0 no-repeat;
}
* html .msp_esp_cont-h{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_h.png',sizingMethod='crop');
}
.msp_esp_cont-b{
position:absolute;
bottom:0;
left:0;
width:688px;
height:24px;
background:url(../img/ombre_content_b.png) 0 0 no-repeat;
}
* html .msp_esp_cont-b{
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_b.png',sizingMethod='crop');
}
.msp_esp_cont-m{
background:url(../img/ombre_content_m.png) 0 0 repeat-y;
padding:0 14px 0 14px;
}
* html .msp_esp_cont-m{
height:1%;
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='./img/ombre_content_m.png',sizingMethod='scale');
}
.msp_esp_pres .msp_esp_sub,
.msp_esp_sub{
text-align:center;
padding:0 0 4px 0;
min-height:1px;
font-size:100%;
}
* html .msp_esp_pres div .msp_esp_sub{
height:auto;
}
.msp_esp_sub a,
.msp_esp_sub a:hover{
display:-moz-inline-box;
background:#010D23 url(../img/bk-input.gif) 0 0 repeat-x;
color:#fff;
border:none;
padding:3px 60px;
text-transform:uppercase;
font-weight:bold;
cursor:pointer;
cursor:hand;
text-decoration:none;
min-height:22px;
}
* html .msp_esp_sub a{
display:inline-block;
height:16px;
}
*:first-child+html .msp_esp_sub a{
display:inline-block;
min-height:16px;
}
.msp_esp_cont-degh{
background:url(../img/deg_content_h.png) 0 0 repeat-x;
}
.msp_esp_cont-degb{
background:url(../img/deg_content_b.png) 0 100% repeat-x;
padding:0 8px 0 8px;
}
.msp_esp_cont-m .msp_esp_btitre{
padding:4px 0 5px 0;
color:#31579c;
font-weight:bold;
font-size:120%;
}
.msp_esp_pres div p{
padding:6px 12px 20px 70px;
font-size:110%;
min-height:65px;
}
* html .msp_esp_pres .msp_esp_cont-degb div p{
height:83px;
}
.msp_esp_pres .msp_esp_btitre{
color:#fff;
padding:4px 10px 5px 10px;
}
.msp_esp_bloc1 .msp_esp_btitre{
background:#143152 url(../img/fond_titre_1.png) 0 0 repeat-x;
}
.msp_esp_bloc1 p{
background:url(../img/illus_1.jpg) 0 0 no-repeat;
}
.msp_esp_bloc2 .msp_esp_btitre{
background:#386722 url(../img/fond_titre_2.png) 0 0 repeat-x;
}
.msp_esp_bloc2 p{
background:url(../img/illus_2.jpg) 0 0 no-repeat;
}
.msp_esp_bloc3 .msp_esp_btitre{
background:#815302 url(../img/fond_titre_3.png) 0 0 repeat-x;
}
.msp_esp_bloc3 p{
background:url(../img/illus_3.jpg) 0 0 no-repeat;
}
.msp_esp_bloc4 .msp_esp_btitre{
background:#862e78 url(../img/fond_titre_4.png) 0 0 repeat-x;
}
.msp_esp_bloc4 p{
background:url(../img/illus_4.jpg) 0 0 no-repeat;
}
.msp_esp_logos {
text-align:center;
list-style-type:none;
padding:0;
margin:12px 0 4px 0;
}
.msp_esp_logos li{
display:inline;
margin:0 8px 0 3px;
}

View File

@ -1,35 +0,0 @@
{% load staticfiles %}
{% load sekizai_tags %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/screen.msp.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/oauth.js" %}"></script>{% endaddtoblock %}
{% comment %}
Emprunté sur caf.fr
{% endcomment %}
{% if 'nomsp' not in request.GET %}
<div class="msp connecting">
<div class="cadre">
<div class="bordure">
<div class="marges">
<p class="flr">
<a href="{% url 'msp-login-or-link' %}{% if request.GET.next or popup %}?{% endif %}{% if request.GET.next %}{{ request.GET.urlencode }}{% endif %}{% if popup %}&popup=1{% endif %}"
title="Connectez-vous avec Mon Service Public" class="connexion{% if popup %} js-oauth-popup{% endif %}">Connexion</a>
</p>
<p>
<strong class="fz">
Nouveau&nbsp;: connectez-vous avec
<img src="{% static "authentic2_auth_msp/img/mon_service-public.fr_petit.png" %}" width="100" height="25" alt="mon.service-public.fr" />
</strong>
</p>
<p class="lien">
<a href="{% url "msp-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</div>
</div>
</div>
</div>
{% endif %}

View File

@ -1,55 +0,0 @@
{% load i18n %}
{% load sekizai_tags %}
{% load staticfiles %}
{% addtoblock "css" %}<link rel="stylesheet" type="text/css" href="{% static 'authentic2_auth_msp/css/screen.msp.css' %}"></link>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/domready.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/getElementsByClassName-1.0.1.js" %}"></script>{% endaddtoblock %}
{% addtoblock "js-endpage" %}<script type="text/javascript" src="{% static "authentic2_auth_msp/js/oauth.js" %}"></script>{% endaddtoblock %}
<div id="msp-linking">
{% if user.is_authenticated and user.mspaccount and user.mspaccount.refresh_token %}
<div class="msp">
<div class="cadre">
<p class="centrer">
<img src="{% static "authentic2_auth_msp/img/toutes_vos_demarches.png" %}" width="140" height="35" alt="Vous &ecirc;tes actuellement en connexion avec" />
<img src="{% static "authentic2_auth_msp/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.Service-Public.fr" />
</p>
<ul class="fond">
<li class="picto">
<p class="lien">
<a href="{% url "msp-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</li>
<li class="picto utilisateur">
<p class="lien">
<a href="{% url "msp-link-management" %}?next={{ request.get_full_path|urlencode }}" class="roll">G&eacute;rer mes liaisons</a>
</p>
</li>
</ul>
</div>
</div>
{% else %}
<div class="msp" style="width: 300px">
<div class="cadre">
<p class="centrer">
<img src="{% static "authentic2_auth_msp/img/toutes_vos_demarches.png" %}" width="140" height="35" alt="Vous &ecirc;tes actuellement en connexion avec" />
<img src="{% static "authentic2_auth_msp/img/mon_service-public.fr.png" %}" width="125" height="30" alt="mon.service-public.fr" />
</p>
<ul class="fond">
<li class="picto">
<p class="lien">
<a href="{% url "msp-more-redirect" %}" target="_blank" class="roll">En savoir plus</a>
</p>
</li>
<li class="picto utilisateur">
<p class="lien">
<a href="{% url 'msp-link' %}?next={{ request.get_full_path }}{% if popup %}&popup=1{% endif %}"
class="{% if popup %}js-oauth-popup{% endif %} roll db">Cr&eacute;er une liaison avec mon.service-public.fr</a>
</p>
</li>
</ul>
</div>
</div>
{% endif %}
</div>

View File

@ -1 +0,0 @@
{% include "authentic2_auth_msp/connecting.html" with popup=1 %}

View File

@ -1,26 +0,0 @@
from django.conf.urls import patterns, url, include
from . import views
msppatterns = patterns('',
url(r'^login/$', views.login, name='msp-login'),
url(r'^link/$', views.link, name='msp-link'),
url(r'^login-or-link/$', views.login_or_link, name='msp-login-or-link'),
url(r'^link-management/$', views.link_management,
name='msp-link-management'),
url(r'^link-management/unlink/confirm/$', views.confirm_unlink,
name='msp-confirm-unlink'),
url(r'^link-management/unlink/done/$', views.unlink_done,
name='msp-unlink-done'),
url(r'^link-management/unlink/$', views.unlink, name='msp-unlink'),
url(r'^authorize/$', views.authorize, name='msp-authorize'),
url(r'^access_token/$', views.access_token, name='msp-access-token'),
url(r'^documents/$', views.documents, name='msp-documents'),
url(r'^documents/(?P<doc_id>[^/]*)/$', views.document,
name='msp-document'),
url(r'^more/$', views.more_redirect, name='msp-more-redirect'),
)
urlpatterns = patterns('',
url(r'^msp/', include(msppatterns)),
)