I've got the latest-ish review board running on a centos 7 system: 

ReviewBoard-2.5.2-2.el7.noarch

The basic Review Board page loads. 

I want to configure authentication so that I can use PAM.

I see some 'old' posts that talk about PAM and LDAP using the same code 
and  but I don't see that code in the new 2.x release. 

I wanted to take a stab at rolling my own auth module but I am just not 
having much luck. Not sure if it is my non-existiant python knowledge or if 
it is incomplete examples. 
A lot of stuff I read on Review Board seems to be written to a group where 
you assume that they have been doing python for years. 

For example... there is this: 

https://www.reviewboard.org/docs/manual/dev/extending/extensions/hooks/auth-backend-hook/

which looks pretty.. and you go great... that's what I need to start 
with... but how, exactly does a new python / Review Board person use this? 

I googled some stuff and found some magic command: 
./contrib/tools/generate_extension.py PamAuthBackend  
--class-name=PamAuthBackend --package-name=pam_auth_backend --author="Jack 
Snodgrass" --description="Pam Auth" --is-configurable

that lets me me create  a stub of sorts. 

I edited the pam_auth_backend/extension.py file that I ended up with and 
put in the code from the
https://www.reviewboard.org/docs/manual/dev/extending/extensions/hooks/auth-backend-hook/
page. 

I changed it a bit and ended up with: 
# PamAuthBackend Extension for Review Board.
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import patterns, include
from reviewboard.extensions.base import Extension
from reviewboard.accounts.backends import AuthBackend
from reviewboard.extensions.hooks import AuthBackendHook

class PamAuthBackend(AuthBackend):
    backend_id = 'myvendor_sample_auth'
    name = 'Sample Authentication'

    def authenticate(self, username, password):
        if username == 'superuser' and password == 's3cr3t':
            return self.get_or_create_user(username, password=password)
        return None

    def get_or_create_user(self, username, request=None, password=None):
        user, is_new = User.objects.get_or_create(username=username)

        if is_new:
            user.set_unusable_password()
            user.save()
        return user

    class SampleExtension(Extension):
        def initialize(self):
            AuthBackendHook(self, PamAuthBackend)



if I run the command
python setup.py develop
and get my PamAuthBackend.egg-info
generated.. after restarting apache I get:

Something broke! (Error 500) 

It appears something broke when you tried to go to here. This is either a 
bug in Review Board or a server configuration error. Please report this to 
your administrator. 


.... which surprisingly... is not very helpful. 



I know almost 0 about python but 

python setup.py install

seems to be something that gets run a lot... so in this case I ran it to 
see what happens and I get: 

.

.

.

.

 File "/usr/lib64/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/lib/python2.7/site-packages/djblets/extensions/packaging.py", 
line 154, in run
    self._build_static_media(extension)
  File "/usr/lib/python2.7/site-packages/djblets/extensions/packaging.py", 
line 169, in _build_static_media
    self._add_bundle(pipeline_js, extension.js_bundles, 'js', '.js')
AttributeError: type object 'PamAuthBackend' has no attribute 'js_bundles'


.... is this install command 'supposed' to work... or is this why I get the 
unexplained 500 error after doing python setup.py develop and creating my 
'egg' package? 



can someone help me out and provide an EXACT list of commands / files to 
run that will get me setup with the stuff from: 


https://www.reviewboard.org/docs/manual/dev/extending/extensions/hooks/auth-backend-hook/


so that I can then look at modifying it. 


Thanks - jack 



-- 
Supercharge your Review Board with Power Pack: 
https://www.reviewboard.org/powerpack/
Want us to host Review Board for you? Check out RBCommons: 
https://rbcommons.com/
Happy user? Let us know! https://www.reviewboard.org/users/
--- 
You received this message because you are subscribed to the Google Groups 
"reviewboard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to reviewboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to