{"id":16526203,"url":"https://github.com/alejandroherr/esngalaxy","last_synced_at":"2025-08-11T07:11:35.751Z","repository":{"id":20742912,"uuid":"24027290","full_name":"AlejandroHerr/EsnGalaxy","owner":"AlejandroHerr","description":"Cas security service provider for silex to authenticate with the ESN Galaxy","archived":false,"fork":false,"pushed_at":"2021-04-27T18:15:38.000Z","size":472,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-09T01:46:54.560Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlejandroHerr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"Security/Core/Authentication/Provider/EsnGalaxyAuthenticationProvider.php","support":null}},"created_at":"2014-09-14T16:42:45.000Z","updated_at":"2015-01-27T17:05:58.000Z","dependencies_parsed_at":"2022-09-11T10:41:02.814Z","dependency_job_id":null,"html_url":"https://github.com/AlejandroHerr/EsnGalaxy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AlejandroHerr/EsnGalaxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroHerr%2FEsnGalaxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroHerr%2FEsnGalaxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroHerr%2FEsnGalaxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroHerr%2FEsnGalaxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlejandroHerr","download_url":"https://codeload.github.com/AlejandroHerr/EsnGalaxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlejandroHerr%2FEsnGalaxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269844135,"owners_count":24484140,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-11T17:26:31.646Z","updated_at":"2025-08-11T07:11:35.723Z","avatar_url":"https://github.com/AlejandroHerr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Silex-EsnGalaxySecurityServiceProvider\n======================================\nA Service Provider for Silex to authenticate through the [ESN Galaxy](http://galaxy.esn.org) CAS server.\nWith some *magic* extending classes could be used to authenticate with other CAS servers. Feel free to fork, edit and so.\n\n**Warning:** This library is still work in progress. Meaning that some components may misbehave a little bit.\n## Instalation\n\n```php\n{\n    \"require\": {\n        \"alejandroherr/silex-esngalaxysecurityserviceprovider\": \"0.1\"\n    }\n}\n```\n[More versions (if available)](https://packagist.org/packages/alejandroherr/silex-esngalaxysecurityserviceprovider)\n## Configuration\nThe comment lines are showing its default value. Only overrider if you need it.\n```php\n$app-\u003eregister(new Silex\\Provider\\SessionServiceProvider());\n$app-\u003eregister(new SecurityServiceProvider());\n\n$app-\u003eregister(new AlejandroHerr\\Silex\\EsnGalaxy\\EsnGalaxyServiceProvider());\n\n$app['security.firewalls'] = [\n    'main' =\u003e [  \n        'esn_galaxy' =\u003e array(   \n            'pattern' =\u003e '^/.*$',\n            'anonymous' =\u003e true,\n            'esn_galaxy' =\u003e [\n                'cas_server' =\u003e [\n                    //'base_url' =\u003e 'galaxy.esn.org',\n                    //'context' =\u003e 'cas',\n                    //'port' =\u003e 443\n                    //'login_path' =\u003e '/login',\n                    //'validation_path' =\u003e '/serviceValidate'\n                ],\n                //'check_path' =\u003e '/cas/validation',\n                //'login_path' =\u003e '/login',\n                // 'first_login_path' =\u003e '/welcome_user'\n                'auth' =\u003e [\n                    //'*' =\u003e [\n                    //        'Local.activeMember' =\u003e 'ROLE_USER',\n                    //        'Local.regularBoardMember' =\u003e 'ROLE_BOARD',\n                    //    ]\n                    //]\n                ]\n            ]\n        ],\n        'logout' =\u003e ['logout_path' =\u003e '/logout'], //if you want a logout\n        'users' =\u003e $app-\u003eshare(function() use ($app){\n            return new Your\\UserProvider();\n        })\n    ]\n];\n\n$app['security.access_rules'] = array(\n    array('^\\/(?!login)', 'ROLE_USER'),\n);\n```\n### first_login_path\nBy adding a `first_login_path` (actually it could be a path or a route), when a logs in for the first time and a new user is created will be redirected to `first_login_path`.\n\nIt could be useful if your application permanent and you want them to provide further information, or if the user are spawned every time to give them some information (or just saying hi).\n### Auth\nThe auth option controls which galaxy-roles from which section can access to the site. It's an array with the following strcture:\n```php\n'auth' =\u003e [\n    'section1' =\u003e [\n        'galaxy_role1' =\u003e 'app_role1',\n        'galaxy_role2' =\u003e 'app_role2',\n    ],\n    'section2' =\u003e [\n        'galaxy_role1' =\u003e 'app_role1',\n        'galaxy_role3' =\u003e 'app_role2',\n    ]\n]\n```\n\nIf section is `*` means 'any section'. Remember that **it can be a regex**. But to tell the Provider it's a regex it must start by `/`.\n\nBy default the configuration is:\n```php\n'auth' =\u003e [\n    '*' =\u003e [\n        'Local.activeMember' =\u003e 'ROLE_USER',\n        'Local.regularBoardMember' =\u003e 'ROLE_BOARD',\n    ]\n]\n```\n#### Examples\n##### Allowing only a country\n```php\n'auth' =\u003e [\n    '/^ES/' =\u003e [\n        'Local.activeMember' =\u003e 'ROLE_USER',\n        'Local.regularBoardMember' =\u003e 'ROLE_BOARD',\n    ]\n]\n```\n##### Allowing only a National Board\n```php\n'auth' =\u003e [\n    '/^ES/' =\u003e [\n        'National.regularBoardMember' =\u003e 'ROLE_USER',\n    ]\n]\n```\n\n### Login and validation\nYou also must define routes for the login and validation paths. Here some examples:\n\n```php\n$app-\u003ematch('/login', function () use ($app){\t\t\n\t$errormsg = null;\n\tif($app['session']-\u003ehas(SecurityContextInterface::AUTHENTICATION_ERROR)){\n\t    $error = $app['session']-\u003eget(SecurityContextInterface::AUTHENTICATION_ERROR);\n\t    $errormsg = $error-\u003egetMessage();\n\t}\n    \n\treturn $app['twig']-\u003erender(\n\t    'login.twig',\n\t    array(\n\t        'loginUrl' =\u003e $app['jasig_cas_client']-\u003egetLoginUrl($app['request']),\n\t        'error' =\u003e $errormsg\n\t    )\n\t);\n});\n$app-\u003ematch('/validation', function() use ($app){});\n```\n\n## License\nReleased under the MIT license. See the LICENSE file for details.\n\n#### Code Hard, Party Harder\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandroherr%2Fesngalaxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falejandroherr%2Fesngalaxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falejandroherr%2Fesngalaxy/lists"}