Loading services/proxy/default-ssl.conf +3 −1 Original line number Diff line number Diff line Loading @@ -134,6 +134,8 @@ # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown # Required for the Open ID connect redirects to work properly RequestHeader set X-Forwarded-Proto 'https' env=HTTPS </VirtualHost> </IfModule> Loading services/webapp/code/rosetta/auth.py 0 → 100644 +26 −0 Original line number Diff line number Diff line from mozilla_django_oidc.auth import OIDCAuthenticationBackend from .core_app.utils import finalize_user_creation # Setup logging import logging logger = logging.getLogger(__name__) class RosettaOIDCAuthenticationBackend(OIDCAuthenticationBackend): def create_user(self, claims): # Call parent user creation function user = super(RosettaOIDCAuthenticationBackend, self).create_user(claims) # Add profile, keys etc. finalize_user_creation(user) return user def get_userinfo(self, access_token, id_token, payload): # Payload must contain the "email" key return payload services/webapp/code/rosetta/context_processors.py 0 → 100644 +9 −0 Original line number Diff line number Diff line import os from django.conf import settings def export_vars(request): data = {} if settings.OIDC_RP_CLIENT_ID: data['OPENID_ENABLED'] = True else: data['OPENID_ENABLED'] = False return data No newline at end of file services/webapp/code/rosetta/core_app/templates/account.html +15 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ <b>Account ID</b> </td> <td> {{data.user.username}} | <a href="/logout/">Logout</a> {{data.user.username}} </td> </tr> Loading Loading @@ -99,8 +99,21 @@ </tr> </table> </form> <div style="margin-left:10px; margin-top:40px"> {% if OPENID_ENABLED %} <form action="{% url 'oidc_logout' %}" method="post"> {% csrf_token %} <input type="submit" value="logout"> </form> {% else %} <form action="/logout/" method="get"> <input type="submit" value="logout"> </form> {% endif %} </div> <br/> <br/> Loading services/webapp/code/rosetta/core_app/templates/navigation.html +18 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ <input type="password" class="form-control" placeholder="Password" name='password'> <input type='submit' class="btn btn-lg ha-btn-lg" value='Login' /> </form> {% if OPENID %} {% endif %} </center> </li> <center> Loading @@ -54,6 +56,22 @@ </center> {% endif %} {% if OPENID_ENABLED %} <li> {% if not user.is_authenticated %} <a href="{% url 'oidc_authentication_init' %}">Login with OpenID Conn. </a> {% endif %} </li> {% endif %} </ul> </nav> {% endif %} Loading
services/proxy/default-ssl.conf +3 −1 Original line number Diff line number Diff line Loading @@ -134,6 +134,8 @@ # MSIE 7 and newer should be able to use keepalive BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown # Required for the Open ID connect redirects to work properly RequestHeader set X-Forwarded-Proto 'https' env=HTTPS </VirtualHost> </IfModule> Loading
services/webapp/code/rosetta/auth.py 0 → 100644 +26 −0 Original line number Diff line number Diff line from mozilla_django_oidc.auth import OIDCAuthenticationBackend from .core_app.utils import finalize_user_creation # Setup logging import logging logger = logging.getLogger(__name__) class RosettaOIDCAuthenticationBackend(OIDCAuthenticationBackend): def create_user(self, claims): # Call parent user creation function user = super(RosettaOIDCAuthenticationBackend, self).create_user(claims) # Add profile, keys etc. finalize_user_creation(user) return user def get_userinfo(self, access_token, id_token, payload): # Payload must contain the "email" key return payload
services/webapp/code/rosetta/context_processors.py 0 → 100644 +9 −0 Original line number Diff line number Diff line import os from django.conf import settings def export_vars(request): data = {} if settings.OIDC_RP_CLIENT_ID: data['OPENID_ENABLED'] = True else: data['OPENID_ENABLED'] = False return data No newline at end of file
services/webapp/code/rosetta/core_app/templates/account.html +15 −2 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ <b>Account ID</b> </td> <td> {{data.user.username}} | <a href="/logout/">Logout</a> {{data.user.username}} </td> </tr> Loading Loading @@ -99,8 +99,21 @@ </tr> </table> </form> <div style="margin-left:10px; margin-top:40px"> {% if OPENID_ENABLED %} <form action="{% url 'oidc_logout' %}" method="post"> {% csrf_token %} <input type="submit" value="logout"> </form> {% else %} <form action="/logout/" method="get"> <input type="submit" value="logout"> </form> {% endif %} </div> <br/> <br/> Loading
services/webapp/code/rosetta/core_app/templates/navigation.html +18 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,8 @@ <input type="password" class="form-control" placeholder="Password" name='password'> <input type='submit' class="btn btn-lg ha-btn-lg" value='Login' /> </form> {% if OPENID %} {% endif %} </center> </li> <center> Loading @@ -54,6 +56,22 @@ </center> {% endif %} {% if OPENID_ENABLED %} <li> {% if not user.is_authenticated %} <a href="{% url 'oidc_authentication_init' %}">Login with OpenID Conn. </a> {% endif %} </li> {% endif %} </ul> </nav> {% endif %}