The pointer was perfect. I am able to use the Jira user DB
for password validation. I was hoping I could do the same
thing without having to go into the TG install tree. But in any
case I have a small test case that works.

At least it did after I fixed the bugs in the code I posted previously ;-)

Thanks Kevin!

Nicky
--

On 8/16/06, Kevin Horn < [EMAIL PROTECTED]> wrote:
There appear to be some instructions in the comments of this code attachment on the wiki (sosmbprovider-after1512):

http://trac.turbogears.org/turbogears/attachment/wiki/IdentityManagement/sosmbprovider-%28after_r1512%29.py

I haven't played with changing providers myself, but maybe that can point you in the right direction...

Hope that helps...


# The new code:

from turbogears.identity.soprovider import *
import turbogears


class SoJiraIdentityProvider(SqlObjectIdentityProvider):
    """
    IdentityProvider that uses Jira for authentication.
    """

    def __init__(self):
        super(SoJiraIdentityProvider, self).__init__()
        get = turbogears.config.get

        self.host = get("identity.sojiraprovider.host", "jira-dev")
        self.port = get("identity.sojiraprovider.port", 8080)
        self.autocreate = get("identity.sojiraprovider.autocreate", True)

        log.info("JIRA host :: %s" % self.host)
        log.info("JIRA port :: %d" % self.port)
        log.info ("autocreate :: %s" % self.autocreate)

    def validate_password(self, user, user_name, password):
        log.info("JIRA validating : %s" % user_name)
        try:
            import xmlrpclib
            url = '' + self.host + ':' + str(self.port) + '/rpc/xmlrpc'
            s = xmlrpclib.ServerProxy(url)
            s.jira1.login(user_name, password)
        except xmlrpclib.Fault, e :
            return False
        else :
            return True

--
--
Nicky Ayoub
G-Mail Account
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to