Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process values in template, alias filter #274

Closed
2 tasks
bersace opened this issue May 9, 2019 · 6 comments
Closed
2 tasks

Process values in template, alias filter #274

bersace opened this issue May 9, 2019 · 6 comments

Comments

@bersace
Copy link
Member

bersace commented May 9, 2019

The need is to process LDAP values while rendering role or grant parameters. This would looks like:

- role:
    name: '{cn.slugify()}'

The trick is to subclass string values with a extended class implementing various filter.

Filters idea

  • upper, lower -> natives.
  • slugify : escape for Posgres native.

Tasks

  • Implementation
  • Documentation
@zurikus
Copy link

zurikus commented May 9, 2019

I think that this feature will spread ldap2pg package usability.
Plus for all this filters from me:

a) upper, lower
b) slugify('some string') // some-string
c) // if you prefer something other than '-' as separator
slugify('some string', '_') // some_string

How could be multiple filters applied at once?
d) lower(slugify('Some String', '_')) // some_string

@zurikus
Copy link

zurikus commented May 10, 2019

At this moment I don't think, that LDAP values filtering will be usable, as we need to authenticate user later and apply a reverse filter on applied previously, but it is error-prone.
It is better to rely on LDAP completely.

@bersace
Copy link
Member Author

bersace commented May 10, 2019

@zurikus

How could be multiple filters applied at once?

Filters are chainable: {cn.filter0().filter1()}. I could even manage to not require () with a bit of magic.

Let's wait for some more feedback on this. Maybe a cookbook section on this subject would help.

@bersace bersace changed the title Process values in template Process values in template, alias filter May 13, 2019
@bersace
Copy link
Member Author

bersace commented May 15, 2019

For now, there is a bug. ldap2pg doesn't properly infer LDAP attributes from {cn.lower()}

@bersace
Copy link
Member Author

bersace commented Aug 26, 2019

For the record, this require Postgres to be able to find back the right value to query LDAP directory for password. This is not likely to be easy. So, the better is not to modify LDAP values in ldap2pg, but rather have a preprocessed attribute directly in LDAP directory.

Let's keep this open for a few weeks before closing it.

@bersace
Copy link
Member Author

bersace commented Nov 5, 2019

I'm closing, post processing in ldap2pg what can't be done in pg_hba is useless. Thanks for the issue.

@bersace bersace closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants