Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
889fdd92
Commit
889fdd92
authored
9 years ago
by
Lukáš Nový
Browse files
Options
Downloads
Patches
Plain Diff
PirateID support
parent
b07c43de
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
helios_auth/auth_systems/__init__.py
+2
-1
2 additions, 1 deletion
helios_auth/auth_systems/__init__.py
helios_auth/auth_systems/pirateid.py
+55
-0
55 additions, 0 deletions
helios_auth/auth_systems/pirateid.py
settings.py
+5
-2
5 additions, 2 deletions
settings.py
with
62 additions
and
3 deletions
helios_auth/auth_systems/__init__.py
+
2
−
1
View file @
889fdd92
AUTH_SYSTEMS
=
{}
import
twitter
,
password
,
cas
,
facebook
,
google
,
yahoo
,
linkedin
import
twitter
,
password
,
cas
,
facebook
,
google
,
yahoo
,
linkedin
,
pirateid
AUTH_SYSTEMS
[
'
twitter
'
]
=
twitter
AUTH_SYSTEMS
[
'
linkedin
'
]
=
linkedin
AUTH_SYSTEMS
[
'
password
'
]
=
password
...
...
@@ -9,6 +9,7 @@ AUTH_SYSTEMS['cas'] = cas
AUTH_SYSTEMS
[
'
facebook
'
]
=
facebook
AUTH_SYSTEMS
[
'
google
'
]
=
google
AUTH_SYSTEMS
[
'
yahoo
'
]
=
yahoo
AUTH_SYSTEMS
[
'
pirateid
'
]
=
pirateid
# not ready
#import live
...
...
This diff is collapsed.
Click to expand it.
helios_auth/auth_systems/pirateid.py
0 → 100644
+
55
−
0
View file @
889fdd92
"""
Yahoo Authentication
"""
from
django.http
import
*
from
django.core.mail
import
send_mail
from
django.conf
import
settings
import
sys
,
os
,
cgi
,
urllib
,
urllib2
,
re
from
xml.etree
import
ElementTree
from
openid
import
view_helpers
# some parameters to indicate that status updating is not possible
STATUS_UPDATES
=
False
# display tweaks
LOGIN_MESSAGE
=
"
Log in with my PirateID
"
OPENID_ENDPOINT
=
'
https://openid.pirati.cz
'
def
get_auth_url
(
request
,
redirect_url
):
request
.
session
[
'
pirateid_redirect_url
'
]
=
redirect_url
url
=
view_helpers
.
start_openid
(
request
.
session
,
OPENID_ENDPOINT
,
redirect_url
,
redirect_url
)
return
url
def
get_user_info_after_auth
(
request
):
data
=
view_helpers
.
finish_openid
(
request
.
session
,
request
.
GET
,
request
.
session
[
'
pirateid_redirect_url
'
])
return
{
'
type
'
:
'
pirateid
'
,
'
user_id
'
:
data
[
'
ax
'
][
'
email
'
][
0
],
'
name
'
:
data
[
'
ax
'
][
'
fullname
'
][
0
],
'
info
'
:
{
'
email
'
:
data
[
'
ax
'
][
'
email
'
][
0
]},
'
token
'
:{}}
def
do_logout
(
user
):
"""
logout of Yahoo
"""
return
None
def
update_status
(
token
,
message
):
"""
simple update
"""
pass
def
send_message
(
user_id
,
user_name
,
user_info
,
subject
,
body
):
"""
send email to yahoo user, user_id is email for yahoo and other openID logins.
"""
send_mail
(
subject
,
body
,
settings
.
SERVER_EMAIL
,
[
"
%s <%s>
"
%
(
user_name
,
user_id
)],
fail_silently
=
False
)
def
check_constraint
(
constraint
,
user_info
):
"""
for eligibility
"""
pass
This diff is collapsed.
Click to expand it.
settings.py
+
5
−
2
View file @
889fdd92
...
...
@@ -76,7 +76,7 @@ MEDIA_URL = ''
STATIC_URL
=
'
/media/
'
# Make this unique, and don't share it with anybody.
SECRET_KEY
=
get_from_env
(
'
SECRET_KEY
'
,
'
replaceme
'
)
SECRET_KEY
=
get_from_env
(
'
SECRET_KEY
'
,
'
replaceme
sadfasdfasdf
'
)
# Secure Stuff
if
(
get_from_env
(
'
SSL
'
,
'
0
'
)
==
'
1
'
):
...
...
@@ -160,7 +160,7 @@ LOGOUT_ON_CONFIRMATION = True
# The two hosts are here so the main site can be over plain HTTP
# while the voting URLs are served over SSL.
URL_HOST
=
get_from_env
(
"
URL_HOST
"
,
"
http://
localhost:8000
"
).
rstrip
(
"
/
"
)
URL_HOST
=
get_from_env
(
"
URL_HOST
"
,
"
http://
helios-server-lnovy.c9.io
"
).
rstrip
(
"
/
"
)
# IMPORTANT: you should not change this setting once you've created
# elections, as your elections' cast_url will then be incorrect.
...
...
@@ -260,3 +260,6 @@ djcelery.setup_loader()
# for testing
TEST_RUNNER
=
'
djcelery.contrib.test_runner.CeleryTestSuiteRunner
'
# this effectively does CELERY_ALWAYS_EAGER = True
SESSION_SERIALIZER
=
'
django.contrib.sessions.serializers.PickleSerializer
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment