Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
slapos.core
Commits
a535186e
Commit
a535186e
authored
Jul 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalise class to allow more backends.
parent
2948a479
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
26 deletions
+16
-26
master/product/Vifib/VifibCookieHashExtractionPlugin.py
master/product/Vifib/VifibCookieHashExtractionPlugin.py
+11
-21
master/product/Vifib/__init__.py
master/product/Vifib/__init__.py
+5
-5
No files found.
master/product/Vifib/Vifib
FacebookServer
ExtractionPlugin.py
→
master/product/Vifib/Vifib
CookieHash
ExtractionPlugin.py
View file @
a535186e
...
@@ -54,14 +54,11 @@ def addVifibFacebookServerExtractionPlugin(dispatcher, id, title=None, REQUEST=N
...
@@ -54,14 +54,11 @@ def addVifibFacebookServerExtractionPlugin(dispatcher, id, title=None, REQUEST=N
'VifibFacebookServerExtractionPlugin+added.'
'VifibFacebookServerExtractionPlugin+added.'
%
dispatcher
.
absolute_url
())
%
dispatcher
.
absolute_url
())
class
Vifib
FacebookServer
ExtractionPlugin
(
BasePlugin
):
class
Vifib
CookieHash
ExtractionPlugin
(
BasePlugin
):
"""
"""
Plugin to authenicate as machines.
Plugin to authenicate as machines.
"""
"""
meta_type
=
"Vifib Facebook Server Extraction Plugin"
# cache_fatory_name proposal to begin configurable
cache_factory_name
=
'facebook_server_auth_token_cache_factory'
security
=
ClassSecurityInfo
()
security
=
ClassSecurityInfo
()
def
__init__
(
self
,
id
,
title
=
None
):
def
__init__
(
self
,
id
,
title
=
None
):
...
@@ -88,13 +85,6 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
...
@@ -88,13 +85,6 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
raise
KeyError
raise
KeyError
return
cache_factory
return
cache_factory
def
setFacebookToken
(
self
,
key
,
body
):
cache_factory
=
self
.
_getCacheFactory
()
cache_duration
=
cache_factory
.
cache_duration
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
cache_plugin
.
set
(
key
,
DEFAULT_CACHE_SCOPE
,
body
,
cache_duration
=
cache_duration
)
def
getKey
(
self
,
key
):
def
getKey
(
self
,
key
):
cache_factory
=
self
.
_getCacheFactory
()
cache_factory
=
self
.
_getCacheFactory
()
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
for
cache_plugin
in
cache_factory
.
getCachePluginList
():
...
@@ -108,16 +98,16 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
...
@@ -108,16 +98,16 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
####################################
####################################
security
.
declarePrivate
(
'extractCredentials'
)
security
.
declarePrivate
(
'extractCredentials'
)
def
extractCredentials
(
self
,
request
):
def
extractCredentials
(
self
,
request
):
""" Extract
facebook
credentials from the request header. """
""" Extract
CookieHash
credentials from the request header. """
creds
=
{}
creds
=
{}
facebook_cookie
=
request
.
get
(
'__ac_facebook_hash'
)
cookie_hash
=
request
.
get
(
self
.
cookie_name
)
if
facebook_cookie
is
not
None
:
if
cookie_hash
is
not
None
:
try
:
try
:
facebook_dict
=
self
.
getKey
(
facebook_cookie
)
user_dict
=
self
.
getKey
(
cookie_hash
)
except
KeyError
:
except
KeyError
:
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
if
'login'
in
facebook
_dict
:
if
'login'
in
user
_dict
:
creds
[
'external_login'
]
=
facebook
_dict
[
'login'
]
creds
[
'external_login'
]
=
user
_dict
[
'login'
]
creds
[
'remote_host'
]
=
request
.
get
(
'REMOTE_HOST'
,
''
)
creds
[
'remote_host'
]
=
request
.
get
(
'REMOTE_HOST'
,
''
)
try
:
try
:
creds
[
'remote_address'
]
=
request
.
getClientAddr
()
creds
[
'remote_address'
]
=
request
.
getClientAddr
()
...
@@ -126,10 +116,10 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
...
@@ -126,10 +116,10 @@ class VifibFacebookServerExtractionPlugin(BasePlugin):
return
creds
return
creds
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
return
DumbHTTPExtractor
().
extractCredentials
(
request
)
manage_editVifibFacebookServerExtractionPluginForm
=
PageTemplateFile
(
class
VifibFacebookServerExtractionPlugin
(
VifibCookieHashExtractionPlugin
):
'www/Vifib_editVifibFacebookServerExtractionPlugin'
,
cache_factory_name
=
'facebook_server_auth_token_cache_factory'
globals
(),
cookie_name
=
'__ac_facebook_hash'
__name__
=
'manage_editVifibFacebookServerExtractionPluginForm'
)
meta_type
=
"Vifib Facebook Server Extraction Plugin"
#List implementation of class
#List implementation of class
classImplements
(
VifibFacebookServerExtractionPlugin
,
classImplements
(
VifibFacebookServerExtractionPlugin
,
...
...
master/product/Vifib/__init__.py
View file @
a535186e
...
@@ -43,7 +43,7 @@ from Products.PluggableAuthService.PluggableAuthService import registerMultiPlug
...
@@ -43,7 +43,7 @@ from Products.PluggableAuthService.PluggableAuthService import registerMultiPlug
import
VifibMachineAuthenticationPlugin
import
VifibMachineAuthenticationPlugin
import
VifibShadowAuthenticationPlugin
import
VifibShadowAuthenticationPlugin
import
Vifib
FacebookServer
ExtractionPlugin
import
Vifib
CookieHash
ExtractionPlugin
def
initialize
(
context
):
def
initialize
(
context
):
import
Document
import
Document
...
@@ -70,11 +70,11 @@ def initialize(context):
...
@@ -70,11 +70,11 @@ def initialize(context):
,
icon
=
'www/portal.gif'
,
icon
=
'www/portal.gif'
)
)
context
.
registerClass
(
Vifib
FacebookServer
ExtractionPlugin
.
VifibFacebookServerExtractionPlugin
context
.
registerClass
(
Vifib
CookieHash
ExtractionPlugin
.
VifibFacebookServerExtractionPlugin
,
permission
=
ManageUsers
,
permission
=
ManageUsers
,
constructors
=
(
,
constructors
=
(
Vifib
FacebookServer
ExtractionPlugin
.
manage_addVifibFacebookServerExtractionPluginForm
,
Vifib
CookieHash
ExtractionPlugin
.
manage_addVifibFacebookServerExtractionPluginForm
,
Vifib
FacebookServer
ExtractionPlugin
.
addVifibFacebookServerExtractionPlugin
,
)
Vifib
CookieHash
ExtractionPlugin
.
addVifibFacebookServerExtractionPlugin
,
)
,
visibility
=
None
,
visibility
=
None
,
icon
=
'www/portal.gif'
,
icon
=
'www/portal.gif'
)
)
...
@@ -82,4 +82,4 @@ def initialize(context):
...
@@ -82,4 +82,4 @@ def initialize(context):
registerMultiPlugin
(
VifibMachineAuthenticationPlugin
.
VifibMachineAuthenticationPlugin
.
meta_type
)
registerMultiPlugin
(
VifibMachineAuthenticationPlugin
.
VifibMachineAuthenticationPlugin
.
meta_type
)
registerMultiPlugin
(
VifibShadowAuthenticationPlugin
.
VifibShadowAuthenticationPlugin
.
meta_type
)
registerMultiPlugin
(
VifibShadowAuthenticationPlugin
.
VifibShadowAuthenticationPlugin
.
meta_type
)
registerMultiPlugin
(
Vifib
FacebookServer
ExtractionPlugin
.
VifibFacebookServerExtractionPlugin
.
meta_type
)
registerMultiPlugin
(
Vifib
CookieHash
ExtractionPlugin
.
VifibFacebookServerExtractionPlugin
.
meta_type
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment