|
|
|
Jaas
Action : was.jaas (Category : was, Name : jaas, By : kikonf)
Complete Name : was.jaas.by.kikonf Version : 5.0 License : Modified BSD License Purpose of the was category : Easy to customize. This category use in background the wsadmin command in jython mode (through AdminConfig, AdminControl and AdminTask), to drive WebSphere Application Server ® configuration. You can use it to manage the whole WebSphere ® architecture. Purpose of this jaas plugin : Creates one Java Authentification Alias entry The following shows the main Source Code File for the Action : was.jaas Toggle lines ## Copyright (c) 2008, Patrick Germain Placidoux ## All rights reserved. ## ## This file is part of Kikonf Public Software. ## ## Kikonf Public Software is released under the modified BSD License, ## which should accompany it or any part of it in the file "COPYING". ## If you do not have this file you can access the license ## through the WWW at http://www.kikonf.org/license/bsd/license.txt. ## ## Home: http://www.kikonf.org ## Contact: kikonf@gmx.com from actions.was.tools import * class Jaas(wasAction): def extract(self, name=None, prefix=None, **keywords): self.verbose(name=name, prefix=prefix) indent=self.getIndent() + 3*' ' verbose('JAASAuthData listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile()) js=split(AdminConfig.list('JAASAuthData', AdminConfig.getid('/Cell:' + self.getCell()))) for jaas in js: jaas=getShowAsDict(AdminConfig.show(jaas)) aname=jaas['alias'] if prefix!=None and name!=None and aname==prefix + '_' + name \ or prefix==None and name!=None and name==aname \ or prefix!=None and name==None and aname.startswith(prefix) \ or prefix==None and name==None: verbose('JAASAuthData:' + aname + ' with user:' + jaas['userId'] + ' retreived.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile()) jaas_node=self.newTop() #-- because in extract, this return a blank url node. try: password=self.getPwdFromJAAS(aname) except:password='???' if jaas.has_key('description') and jaas['description']!=None:desc=jaas['description'][1:-1] else:desc=None if desc==DESIGN_NOTICE:desc=None attrs={'name':aname, 'user':jaas['userId'], 'password':password, 'desc':desc} jaas_node.setAttrs(**attrs) #-- feeding it with attributes. def remove(self, no_name, no_name_no_prefix): self_funct='remove' jaas_node = self.getTop() jaas_attrs = jaas_node.getAttrs() self.verbose(name=jaas_attrs.name, prefix=jaas_attrs.prefix) indent=self.getIndent() + 3*' ' # no_name/no_name_no_prefix prefix=jaas_attrs.prefix name=jaas_attrs.name if no_name or no_name_no_prefix:name=None if no_name_no_prefix:prefix=None self.rmvJaas(name=name, prefix=prefix, indent=indent) def inject(self): self_funct='inject' jaas_node = self.getTop() jaas_attrs = jaas_node.getAttrs() self.verbose(name=jaas_attrs.name, prefix=jaas_attrs.prefix) indent=self.getIndent() + 3*' ' self.rmvJaas(name=jaas_attrs.name, prefix=jaas_attrs.prefix, indent=indent) #-- remove first #-- name if jaas_attrs.prefix==None:name=jaas_attrs.name else:name=jaas_attrs.prefix + '_' + jaas_attrs.name cmdvalues=[] cmdvalues.append(['alias', name]) cmdvalues.append(['userId', jaas_attrs.user]) cmdvalues.append(['password', jaas_attrs.password]) if jaas_attrs.desc!=None:cmdvalues.append(['description', jaas_attrs.desc]) else:desc=cmdvalues.append(['description', DESIGN_NOTICE]) # Creates verbose('Security listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile()) s=AdminConfig.list('Security') verbose('JAASAuthData:' + jaas_attrs.name + ' creating.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile()) jsid=AdminConfig.create('JAASAuthData', s, cmdvalues) verbose('JAASAuthData:' + jaas_attrs.name + ' with user:' + jaas_attrs.user + ' created.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile()) def rmvJaas(self, name=None, prefix=None, indent=None): verbose('JAASAuthData listing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile()) js=split(AdminConfig.list('JAASAuthData', AdminConfig.getid('/Cell:' + self.getCell()))) for jaas in js: aname=AdminConfig.showAttribute(jaas, 'alias') if prefix!=None and aname.startswith(prefix) \ or prefix==None and name!=None and name==aname \ or prefix==None and name==None: verbose('JAASAuthData:' + aname + ' removing.', level=self.getVerbose(), ifLevel=4, indent=indent, logFile=self.getLogFile()) AdminConfig.remove(jaas) verbose('JAASAuthData:' + aname + ' removed.', level=self.getVerbose(), ifLevel=3, indent=indent, logFile=self.getLogFile()) def verbose(self, name=None, prefix=None): if name!=None:verbose('JAASAuthData:' + name + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent()) elif prefix!=None:verbose('JAASAuthDatas under prefix:' + prefix + '.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent()) else:verbose('JAASAuthDatas.', level=self.getVerbose(), ifLevel=2, indent=self.getIndent())
Trademarks :
|