View | Details | Raw Unified | Return to bug 31861 | Differences between
and this patch

Collapse All | Expand All

(-)original/univention-management-console/src/univention/management/console/auth.py (-11 / +21 lines)
 Lines 247-268   class AuthHandler( signals.Provider ): Link Here 
247
		self.signal_new( 'authenticated' )
247
		self.signal_new( 'authenticated' )
248
		self.__credentials = None
248
		self.__credentials = None
249
249
250
	def _create_modules( self, username, password ):
250
	def _create_modules( self, **kwargs ):
251
		global _all_modules
251
		global _all_modules
252
		self._modules = []
252
		self._modules = []
253
		for mod in _all_modules:
253
		for mod in _all_modules:
254
			instance = mod( username, password )
254
			try:
255
			instance.signal_connect( 'auth_return', self._auth_return )
255
				instance = mod( kwargs['username'] , kwargs['password'] )
256
			instance.signal_connect( 'password_changed', self._password_changed )
256
				instance.signal_connect( 'auth_return', self._auth_return )
257
			self._modules.append( instance )
257
				instance.signal_connect( 'password_changed', self._password_changed )
258
				self._modules.append( instance )
259
			except Exception, e:
260
				AUTH.warn( "AuthHandler - _create_modules error: %s" % str( e ) )
258
		self._modules.reverse()
261
		self._modules.reverse()
262
	  
263
	def authenticate( self, **kwargs ):
264
		try:
265
			if kwargs['auth_type'] == "saml":
266
				AUTH.warn('__starting SAML Authenticate __')
267
								
268
			self._create_modules( **kwargs )
269
			self._current = self._modules.pop()
270
			self.__new_password = kwargs['new_password']
271
			self._current.authenticate()
272
			self.__credentials = ( kwargs['username'], kwargs['password'] )
273
		except Exception, e:
274
			AUTH.warn( "authenticate.... error: %s" % str( e ) )
259
275
260
	def authenticate( self, username, password, new_password=None ):
261
		self._create_modules( username, password )
262
		self._current = self._modules.pop()
263
		self.__new_password = new_password
264
		self._current.authenticate()
265
		self.__credentials = ( username, password )
266
276
267
	def credentials( self ):
277
	def credentials( self ):
268
		return self.__credentials
278
		return self.__credentials
(-)original/univention-management-console/src/univention/management/console/protocol/client.py (-5 / +4 lines)
 Lines 31-37    Link Here 
31
# <http://www.gnu.org/licenses/>.
31
# <http://www.gnu.org/licenses/>.
32
32
33
"""Provides a class :class:`.Client` that implements an UMCP client"""
33
"""Provides a class :class:`.Client` that implements an UMCP client"""
34
35
import errno, os, socket, sys, fcntl
34
import errno, os, socket, sys, fcntl
36
35
37
from univention.lib.i18n import Translation
36
from univention.lib.i18n import Translation
 Lines 340-351   class Client( signals.Provider, Translat Link Here 
340
		else:
339
		else:
341
			self.signal_emit( 'error', UnknownRequestError() )
340
			self.signal_emit( 'error', UnknownRequestError() )
342
341
343
	def authenticate( self, username, password, new_password=None ):
342
	def authenticate( self, **kwargs ):
344
		"""Authenticate against the UMC server"""
343
		"""Authenticate against the UMC server"""
345
		authRequest = Request ('AUTH' )
344
		authRequest = Request ('AUTH' )
346
		authRequest.body['username'] = username
345
		
347
		authRequest.body['password'] = password
346
		for opt in kwargs:
348
		authRequest.body['new_password'] = new_password
347
			authRequest.body[opt] = kwargs[opt]
349
348
350
		self.request( authRequest )
349
		self.request( authRequest )
351
350
(-)original/univention-management-console/src/univention/management/console/protocol/server.py (-1 / +3 lines)
 Lines 35-40    Link Here 
35
Defines the basic class for an UMC server.
35
Defines the basic class for an UMC server.
36
"""
36
"""
37
37
38
38
# python packages
39
# python packages
39
import fcntl
40
import fcntl
40
import gzip
41
import gzip
 Lines 213-219   class MagicBucket( object ): Link Here 
213
		elif msg.command == 'AUTH':
214
		elif msg.command == 'AUTH':
214
			state.authResponse = Response( msg )
215
			state.authResponse = Response( msg )
215
			try:
216
			try:
216
				state.authenticate( msg.body[ 'username' ], msg.body[ 'password' ], msg.body.get( 'new_password' ) )
217
				state.authenticate( **{'auth_type':msg.body[ 'auth_type' ],'username':msg.body[ 'username' ], 'password':msg.body[ 'password' ], 'new_password':msg.body.get( 'new_password' )} )
217
			except ( TypeError, KeyError ), e:
218
			except ( TypeError, KeyError ), e:
218
				state.authResponse.status = BAD_REQUEST_INVALID_OPTS
219
				state.authResponse.status = BAD_REQUEST_INVALID_OPTS
219
				state.authResponse.message = 'insufficient authentification information'
220
				state.authResponse.message = 'insufficient authentification information'
 Lines 500-505   class Server( signals.Provider ): Link Here 
500
501
501
	def _connection( self, socket ):
502
	def _connection( self, socket ):
502
		'''Signal callback: Invoked on incoming connections.'''
503
		'''Signal callback: Invoked on incoming connections.'''
504
503
		socket, addr = socket.accept()
505
		socket, addr = socket.accept()
504
		socket.setblocking( 0 )
506
		socket.setblocking( 0 )
505
		if addr:
507
		if addr:
(-)original/univention-management-console/src/univention/management/console/protocol/session.py (-3 / +3 lines)
 Lines 99-108   class State( signals.Provider ): Link Here 
99
	def _authenticated( self, success ):
99
	def _authenticated( self, success ):
100
		self.signal_emit( 'authenticated', success, self )
100
		self.signal_emit( 'authenticated', success, self )
101
101
102
	def authenticate( self, username, password, new_password=None ):
102
	def authenticate( self,  **kwargs  ):
103
		"""Initiates an authentication process"""
103
		"""Initiates an authentication process"""
104
		self.username = username
104
		self.username = kwargs['username']
105
		self.__auth.authenticate( username, password, new_password )
105
		self.__auth.authenticate( **kwargs )
106
106
107
	def credentials( self ):
107
	def credentials( self ):
108
		"""Returns the credentials"""
108
		"""Returns the credentials"""
(-)original/univention-management-console-frontend/univention-management-console-web-server (-6 / +5 lines)
 Lines 133-139   class SessionClient(object): Link Here 
133
		self._auth_response = umcp.Response( request )
133
		self._auth_response = umcp.Response( request )
134
		self._auth_response.body['sessionid'] = request.body.get('sessionid','')
134
		self._auth_response.body['sessionid'] = request.body.get('sessionid','')
135
		self._auth_response_queue = response_queue
135
		self._auth_response_queue = response_queue
136
		self.client.authenticate( request.body[ 'username' ], request.body[ 'password' ], request.body[ 'new_password' ] )
136
		self.client.authenticate( **request.body )
137
137
138
	def _response(self, response):
138
	def _response(self, response):
139
		"""Queue response from UMC server."""
139
		"""Queue response from UMC server."""
 Lines 553-568   class CPAuth(CPgeneric): Link Here 
553
			body = cherrypy.request.body.read()
553
			body = cherrypy.request.body.read()
554
554
555
		json = self.load_json(body)
555
		json = self.load_json(body)
556
557
		CORE.info('CPRoot/command: request: command=%s' % cherrypy.request.path_info )
556
		CORE.info('CPRoot/command: request: command=%s' % cherrypy.request.path_info )
558
557
559
		# create new UMCP request
558
		# create new UMCP request
560
		req = umcp.Request( 'AUTH' )
559
		req = umcp.Request( 'AUTH' )
561
		req.body[ 'username' ] = json[ 'options' ].get('username','')
560
		for opt in json['options']:
562
		req.body[ 'password' ] = json[ 'options' ].get('password','')
561
			req.body[opt] = json['options'][opt]
563
		req.body[ 'new_password' ] = json[ 'options' ].get('new_password')
562
		req.body[ 'new_password' ] = json[ 'options' ].get('new_password')	
564
563
565
		# create new response queue
564
		# create new response queue		
566
		response_queue = Queue.Queue()
565
		response_queue = Queue.Queue()
567
566
568
		# send request to UMC server
567
		# send request to UMC server

Return to bug 31861