Commit 9766ac0a authored by Łukasz Nowak's avatar Łukasz Nowak

Provide Google AS extraction.

parent a535186e
...@@ -36,24 +36,6 @@ from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin ...@@ -36,24 +36,6 @@ from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin
from Products.PluggableAuthService.PluggableAuthService import DumbHTTPExtractor from Products.PluggableAuthService.PluggableAuthService import DumbHTTPExtractor
from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE
#Form for new plugin in ZMI
manage_addVifibFacebookServerExtractionPluginForm = PageTemplateFile(
'www/Vifib_addVifibFacebookServerExtractionPlugin', globals(),
__name__='manage_addVifibFacebookServerExtractionPluginForm')
def addVifibFacebookServerExtractionPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a VifibFacebookServerExtractionPlugin to a Pluggable Auth Service. """
plugin = VifibFacebookServerExtractionPlugin(id, title)
dispatcher._setObject(plugin.getId(), plugin)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibFacebookServerExtractionPlugin+added.'
% dispatcher.absolute_url())
class VifibCookieHashExtractionPlugin(BasePlugin): class VifibCookieHashExtractionPlugin(BasePlugin):
""" """
Plugin to authenicate as machines. Plugin to authenicate as machines.
...@@ -116,6 +98,24 @@ class VifibCookieHashExtractionPlugin(BasePlugin): ...@@ -116,6 +98,24 @@ class VifibCookieHashExtractionPlugin(BasePlugin):
return creds return creds
return DumbHTTPExtractor().extractCredentials(request) return DumbHTTPExtractor().extractCredentials(request)
#Form for new plugin in ZMI
manage_addVifibFacebookServerExtractionPluginForm = PageTemplateFile(
'www/Vifib_addVifibFacebookServerExtractionPlugin', globals(),
__name__='manage_addVifibFacebookServerExtractionPluginForm')
def addVifibFacebookServerExtractionPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a VifibFacebookServerExtractionPlugin to a Pluggable Auth Service. """
plugin = VifibFacebookServerExtractionPlugin(id, title)
dispatcher._setObject(plugin.getId(), plugin)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibFacebookServerExtractionPlugin+added.'
% dispatcher.absolute_url())
class VifibFacebookServerExtractionPlugin(VifibCookieHashExtractionPlugin): class VifibFacebookServerExtractionPlugin(VifibCookieHashExtractionPlugin):
cache_factory_name = 'facebook_server_auth_token_cache_factory' cache_factory_name = 'facebook_server_auth_token_cache_factory'
cookie_name = '__ac_facebook_hash' cookie_name = '__ac_facebook_hash'
...@@ -127,3 +127,32 @@ classImplements( VifibFacebookServerExtractionPlugin, ...@@ -127,3 +127,32 @@ classImplements( VifibFacebookServerExtractionPlugin,
) )
InitializeClass(VifibFacebookServerExtractionPlugin) InitializeClass(VifibFacebookServerExtractionPlugin)
#Form for new plugin in ZMI
manage_addVifibGoogleServerExtractionPluginForm = PageTemplateFile(
'www/Vifib_addVifibGoogleServerExtractionPlugin', globals(),
__name__='manage_addVifibGoogleServerExtractionPluginForm')
def addVifibGoogleServerExtractionPlugin(dispatcher, id, title=None, REQUEST=None):
""" Add a VifibGoogleServerExtractionPlugin to a Pluggable Auth Service. """
plugin = VifibGoogleServerExtractionPlugin(id, title)
dispatcher._setObject(plugin.getId(), plugin)
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(
'%s/manage_workspace'
'?manage_tabs_message='
'VifibGoogleServerExtractionPlugin+added.'
% dispatcher.absolute_url())
class VifibGoogleServerExtractionPlugin(VifibCookieHashExtractionPlugin):
cache_factory_name = 'google_server_auth_token_cache_factory'
cookie_name = '__ac_google_hash'
meta_type = "Vifib Google Server Extraction Plugin"
#List implementation of class
classImplements( VifibGoogleServerExtractionPlugin,
plugins.ILoginPasswordHostExtractionPlugin
)
InitializeClass(VifibGoogleServerExtractionPlugin)
...@@ -79,7 +79,17 @@ def initialize(context): ...@@ -79,7 +79,17 @@ def initialize(context):
, icon='www/portal.gif' , icon='www/portal.gif'
) )
context.registerClass( VifibCookieHashExtractionPlugin.VifibGoogleServerExtractionPlugin
, permission=ManageUsers
, constructors=(
VifibCookieHashExtractionPlugin.manage_addVifibGoogleServerExtractionPluginForm,
VifibCookieHashExtractionPlugin.addVifibGoogleServerExtractionPlugin, )
, visibility=None
, icon='www/portal.gif'
)
registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type) registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type)
registerMultiPlugin(VifibShadowAuthenticationPlugin.VifibShadowAuthenticationPlugin.meta_type) registerMultiPlugin(VifibShadowAuthenticationPlugin.VifibShadowAuthenticationPlugin.meta_type)
registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin.meta_type) registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin.meta_type)
registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibGoogleServerExtractionPlugin.meta_type)
<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
<h2 tal:define="form_title string:Add ERP5 Google Server Extraction Plugin"
tal:replace="structure context/manage_form_title">FORM TITLE</h2>
<p class="form-help">Please input the configuration</p>
<form action="addVifibGoogleServerExtractionPlugin" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
<td align="left" valign="top">
<div class="form-label">
Id
</div>
</td>
<td align="left" valign="top">
<input type="text" name="id" size="40" />
</td>
</tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Title
</div>
</td>
<td align="left" valign="top">
<input type="text" name="title" size="40" />
</td>
</tr>
<tr>
<td colspan="2"> <input type="submit" value="add plugin"/>
</td>
</tr>
</table>
</form>
<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>
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