Commit 765da6ce authored by root's avatar root
Browse files

- Add the old OCF user on the clearing house and minor fixes

parent 42af8893
......@@ -167,6 +167,17 @@ class Portal:
# # Returns authentication result.
# return authentication_result
@staticmethod
def create_old_account(member_attr):
"""
Create the old fibre OCF user account on the new portal
"""
# Initialize context dictionary.
context = {'email_taken': False, 'request_completed': False}
context.update(Member().create_member(
Portal.get_portal_credential(), member_attr))
@staticmethod
def shib_authentication(email):
''' Performs the CH authentication of an already authenticated Shibboleth
......@@ -200,8 +211,10 @@ class Portal:
# Set members.
members = operation['operation_message']
# An error occurred.
if(operation['operation_status'] == 'error'):
# Error log.
print ("Error")
logging.error(members)
# Return an "Internal Server Error" 500 response code.
return HttpResponse(status=500)
......
portal/static/images/rodape.png

56.4 KB | W: | H:

portal/static/images/rodape.png

56.1 KB | W: | H:

portal/static/images/rodape.png
portal/static/images/rodape.png
portal/static/images/rodape.png
portal/static/images/rodape.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -3,7 +3,7 @@ var currentForm;
$(document).ready(function() {
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
window.terminal_ws_url = ws_scheme + '://' + window.location.host + '/ws/';
window.terminal_ws_url = 'wss://portal-fibre.cafeexpresso.rnp.br/ws/';
window.terminal_ws_url = 'wss://portal.fibre.org.br:8001/';
registerCloseEvent();
......@@ -658,4 +658,4 @@ $(document).ready(function() {
$(tabContentId).remove(); //remove respective tab content
}
}
});
\ No newline at end of file
});
......@@ -53,7 +53,7 @@
<div style="height:50px; background-color:#f3f3f3;">
<div class="col-xs-7" style="height:100%; padding:15px">
<!-- <a href="javascript:toggleDiv('local-sign-in');">My account is not federated.</a> -->
<a href="https://portal-fibre.cafeexpresso.rnp.br/Login">FIBRE IdP Login</a>
<a href="https://portal.fibre.org.br/Login">FIBRE IdP Login</a>
</div>
<div class="col-xs-5" align="right" style="height:100%; padding:9px">
<a class="btn btn-primary" href="{% url 'portal:cafe_authentication' %}">Access</a>
......
......@@ -93,22 +93,19 @@ def fibre_idp_authentication(request):
# Gets eppn from shib session.
eppn = request.META.get('Shib-eduPerson-eduPersonPrincipalName', None)
# Check if there is this email in the CH.
email = request.META.get('Shib-inetOrgPerson-mail', None)
# Check if given email exists in CH.
# Bypass auth
request_email = request.GET.get('email')
allowed_emails = ['brunosoares.inf@gmail.com', 'g.ndias@gmail.com', 'gustavo.dias@rnp.br', 'daniel.marques@rnp.br',
'inf.araujo@gmail.com', 'vinicius.esufg@gmail.com']
if request_email is not None and request_email in allowed_emails:
eppn = '8902689e17dca5f25352360f68a55f96@rnp.br'
email = request_email
email_check = Portal.check_identifier(const.CH_MEMBER_EMAIL_ADDRESS, email)
# Authentication failed.
# Add old fibre user on the clearing house
if eppn and email and not email_check:
member_attr = create_ch_member_attributes(email, eppn)
Portal.create_old_account(member_attr)
# Authentication failed.
if not eppn or not email_check:
# Render template.
return redirect('portal:fibre_idp_authentication_failed')
......@@ -122,6 +119,54 @@ def fibre_idp_authentication(request):
# Performs the login.
return shib_login(request, login_result)
def create_ch_member_attributes(email, eppn):
"""
This method gets member data to form and generate a
dictionary in the format required by the CH
"""
aux_email = email
name, domain = email.split("@")
filiation = "RNP"
member_attrs = [
{'name': const.CH_MEMBER_EMAIL_ADDRESS,
'value': email,
'self_asserted': False},
{'name': const.CH_MEMBER_FIRST_NAME,
'value': name,
'self_asserted': True},
{'name': const.CH_MEMBER_LAST_NAME,
'value': "change_me",
'self_asserted': True},
{'name': const.CH_MEMBER_AFFILIATION,
'value': "rnp",
'self_asserted': True},
{'name': const.CH_MEMBER_AFFILIATION_TYPE,
'value': "studenty",
'self_asserted': True},
{'name': const.CH_MEMBER_EPPN,
'value': eppn,
'self_asserted': False},
{'name': const.CH_MEMBER_ENABLED,
'value': True,
'self_asserted': False},
{'name': const.CH_MEMBER_COUNTRY,
'value': "",
'self_asserted': True},
{'name': const.CH_MEMBER_CITY,
'value': "",
'self_asserted': True},
{'name': const.CH_MEMBER_SKYPE,
'value': "",
'self_asserted': True},
{'name': const.CH_MEMBER_PHONE_NUMBER,
'value': "",
'self_asserted': True},
{'name': const.CH_MEMBER_ADDITIONAL_INFO,
'value': "",
'self_asserted': True}]
return member_attrs
def fibre_idp_authentication_failed(request):
"""
......@@ -213,6 +258,7 @@ def shib_login(request, login_result):
# If error_message, some problem happened with login.
if 'error_message' in login_result:
# Set context message.
print ("Login error")
context = {
# 'form': LoginForm(),
'error_message': login_result['error_message']}
......@@ -222,6 +268,8 @@ def shib_login(request, login_result):
# Set member_urn as the urn of retrieved member.
member_urn = login_result['member'].get(const.CH_MEMBER_URN, '')
print(member_urn)
# Retrieve member certificate.
retrieve_operation = util.parse_certificate(
Member().retrieve_certificate(Portal.get_portal_credential(),
......
......@@ -150,7 +150,7 @@ EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
PORTAL_DOMAIN = "portal-fibre.cafeexpresso.rnp.br"
CH_URL = "http://10.128.0.161:8080"
PORTAL_DOMAIN = "portal.fibre.org.br"
#CH_URL = "http://10.128.0.161:8080"
# CH_URL = "http://localhost:8081"
# from portal_config.localsettings import *
from portal_config.localsettings import *
......@@ -170,7 +170,7 @@ GUACD_PORT = '4822'
ASGI_APPLICATION = 'webterminal.routing.application'
# EC SSH Settings
EC_IP_ADDRESS = '10.136.0.210'
EC_IP_ADDRESS = '10.128.0.210'
EC_USERNAME = 'root'
EC_PASSWORD = 'l4b0r4N#W'
EC_PORT = 22
......@@ -9,8 +9,8 @@ Type=simple
PIDFile=/var/run/ws-webterminal.pid
WorkingDirectory=/var/www/portal
ExecStartPre=/bin/rm -f /var/run/ws-webterminal.pid
ExecStart=/usr/local/bin/daphne --root-path=/var/www/portal -p 8000 webterminal.asgi:application --access-log /var/log/ws-webterminal.log
ExecStart=/usr/local/bin/daphne --root-path=/var/www/portal -b 0.0.0.0 -p 8001 webterminal.asgi:application --access-log /var/log/ws-webterminal.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
\ No newline at end of file
WantedBy=multi-user.target
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment