{"id":19341889,"url":"https://github.com/iris-it/lmod-authz-ldap","last_synced_at":"2026-02-27T21:09:54.289Z","repository":{"id":56993473,"uuid":"112612465","full_name":"iris-it/lmod-authz-ldap","owner":"iris-it","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-02T12:47:22.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-24T08:45:56.161Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iris-it.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-30T13:07:14.000Z","updated_at":"2019-08-02T12:46:56.000Z","dependencies_parsed_at":"2022-08-21T13:20:27.070Z","dependency_job_id":null,"html_url":"https://github.com/iris-it/lmod-authz-ldap","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/iris-it/lmod-authz-ldap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-it%2Flmod-authz-ldap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-it%2Flmod-authz-ldap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-it%2Flmod-authz-ldap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-it%2Flmod-authz-ldap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iris-it","download_url":"https://codeload.github.com/iris-it/lmod-authz-ldap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iris-it%2Flmod-authz-ldap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29914025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"ssl_error","status_checked_at":"2026-02-27T19:37:41.463Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T03:33:02.250Z","updated_at":"2026-02-27T21:09:54.267Z","avatar_url":"https://github.com/iris-it.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authz Ldap Module\n\nDocumentation du module d'authentification et d'authorisation\n\n## Fonctionnalités\n\n#### Guest\n- Sign in\n\n#### Admin\n- List of users\n-- Assign role to user \n-- Trigger ldap sync\n\n- List of permissions \n-- Parse from source file\n-- Edit descriptions\n\n- List of roles\n-- Create role\n-- Edit role \n--- Assign permissions to role\n\n## Install\n\nBegin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html.\n\ncomposer require `\"laravelcollective/html\":\"^5.4.0\"`\ncomposer require `\"adldap2/adldap2-laravel\": \"^3.0\"`\n\nNext, add your new provider to the providers array of config/app.php:\n\n```php\n  'providers' =\u003e [\n    // ...\n    Collective\\Html\\HtmlServiceProvider::class,\n    Irisit\\AuthzLdap\\AuthzServiceProvider::class,\n    Adldap\\Laravel\\AdldapServiceProvider::class,\n    Adldap\\Laravel\\AdldapAuthServiceProvider::class,\n    // ...\n  ],\n```\n\nFinally, add two class aliases to the aliases array of config/app.php:\n\n```php\n  'aliases' =\u003e [\n    // ...\n      'Form' =\u003e Collective\\Html\\FormFacade::class,\n      'Html' =\u003e Collective\\Html\\HtmlFacade::class,\n      'Adldap' =\u003e Adldap\\Laravel\\Facades\\Adldap::class,\n    // ...\n  ],\n```\n\nReplace all the in the `App\\User::class`\n```\n\u003c?php\n\nnamespace App;\n\nuse Adldap\\Laravel\\Traits\\HasLdapUser;\nuse Illuminate\\Notifications\\Notifiable;\nuse Irisit\\AuthzLdap\\Models\\BaseUser as Authenticatable;\n\nclass User extends Authenticatable\n{\n    use Notifiable, HasLdapUser;\n\n    /**\n     * The attributes that are mass assignable.\n     *\n     * @var array\n     */\n    protected $fillable = [\n        'firstname',\n        'lastname',\n        'username',\n        'email',\n        'password',\n        'role_id'\n    ];\n\n    /**\n     * The attributes that should be hidden for arrays.\n     *\n     * @var array\n     */\n    protected $hidden = [\n        'password', 'remember_token',\n    ];\n}\n```\n\n\nReplace in migrations the `name` attribute by \n```\n$table-\u003estring('firstname');\n$table-\u003estring('lastname');\n$table-\u003estring('username')-\u003eunique();\n```\n\nReplace the line in `App\\Http\\Kernel.php`\n\n`'guest' =\u003e \\App\\Http\\Middleware\\RedirectIfAuthenticated::class,`\n\nby\n\n`'guest' =\u003e \\Irisit\\AuthzLdap\\Http\\Middleware\\RedirectIfAuthenticated::class,`\n\nAnd add at the end ( after guest )\n \n`'role' =\u003e \\Irisit\\AuthzLdap\\Http\\Middleware\\RedirectIfNotRole::class,`\n\nso you can use the middleware 'role' to protect a route or a group like this `middleware =\u003e 'role:admin,manager'`\n\n\nRun \n\n`php artisan db:seed --class=Irisit\\AuthzLdap\\Database\\Seeds\\DatabaseSeeder`\n\nAdd to config/filesystem.php\n\n```\n        'base' =\u003e [\n            'driver' =\u003e 'local',\n            'root' =\u003e base_path() . DIRECTORY_SEPARATOR,\n        ],\n```\n\nAdd this to app/Exceptions/Handler.php\n```php\n/**\n * @override\n * @param \\Illuminate\\Http\\Request $request\n * @param AuthenticationException $exception\n * @return \\Illuminate\\Http\\JsonResponse|\\Illuminate\\Http\\RedirectResponse|\\Illuminate\\Http\\Response\n */\nprotected function unauthenticated($request, AuthenticationException $exception)\n{\n    return $request-\u003eexpectsJson()\n        ? response()-\u003ejson(['message' =\u003e 'Unauthenticated.'], 401)\n        : redirect()-\u003eguest(route('authz.get_login'));\n}\n```\n\n\nAnd run `php artisan vendor:publish --provider=\"Irisit\\AuthzLdap\\AuthzServiceProvider\"` to get the configuration file and the seeder file \n\nFor the seeder add `$this-\u003ecall(RoleTableSeeder::class);` to the `/database/seeders/DatabaseSeeder.php`\n\nto import users : \n`php artisan adldap:import`\n\nto get groups : \n`php artisan lmod_authz:import_groups_ldap`\n\nto get permissions : \n`php artisan lmod_authz:parse_permissions`\n\nto promote user as admin : \n`php artisan lmod_authz:promote_user_admin`\n_______________________________\n\nIn order to use the filters you have to create a scope \n\n```\n\u003c?php\n\nnamespace App\\Scopes;\n\nuse Adldap\\Query\\Builder;\nuse Adldap\\Laravel\\Scopes\\ScopeInterface;\n\nclass FilterScope implements ScopeInterface\n{\n    /**\n     * {@inheritdoc}\n     */\n    public function apply(Builder $builder)\n    {\n        $builder-\u003erawFilter(config('irisit_authz.ldap_filters'));\n    }\n}\n\n```\n\nAnd add the scope to `adldap_auth.php` config file\n\n```\n    'scopes' =\u003e [\n\n        // Only allows users with a user principal name to authenticate.\n\n        App\\Scopes\\SamAccountNameScope::class,\n\n        App\\Scopes\\FilterScope::class, \u003c---\n\n    ],\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firis-it%2Flmod-authz-ldap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firis-it%2Flmod-authz-ldap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firis-it%2Flmod-authz-ldap/lists"}