{"id":26378130,"url":"https://github.com/cosmonovarnd/auth","last_synced_at":"2025-03-17T04:37:05.934Z","repository":{"id":56958258,"uuid":"116004132","full_name":"CosmonovaRnD/Auth","owner":"CosmonovaRnD","description":"Simple auth library","archived":false,"fork":false,"pushed_at":"2018-01-15T13:17:40.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-05T05:47:23.090Z","etag":null,"topics":["auth2","jwt","symfony4"],"latest_commit_sha":null,"homepage":null,"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/CosmonovaRnD.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":null,"support":null}},"created_at":"2018-01-02T10:34:39.000Z","updated_at":"2018-01-02T10:50:46.000Z","dependencies_parsed_at":"2022-08-21T08:50:52.257Z","dependency_job_id":null,"html_url":"https://github.com/CosmonovaRnD/Auth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmonovaRnD%2FAuth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmonovaRnD%2FAuth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmonovaRnD%2FAuth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CosmonovaRnD%2FAuth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CosmonovaRnD","download_url":"https://codeload.github.com/CosmonovaRnD/Auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243976474,"owners_count":20377693,"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","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":["auth2","jwt","symfony4"],"created_at":"2025-03-17T04:37:05.352Z","updated_at":"2025-03-17T04:37:05.926Z","avatar_url":"https://github.com/CosmonovaRnD.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple OAuth 2.0 library for Symfony 4 projects\n\nAt this time, library allow to auth using JWT with OAuth2 `Authorization Code` flow.\n\n# Installation\n\nInstall package using composer\n\n\u003e composer req cosmonova-rnd/auth\n\n# Basic configuration\n\n1. Enable session handler in your application\n\n```yml\nframework:\n    session:\n        handler_id: ~\n```\n\n2. Configure DB connection, then add new entity manager `auth` to your application config\n\n```yml\ndoctrine:\n    orm:\n        entity_managers:\n            auth:\n                connection: default ## may be your custom connection\n                default_repository_class: 'CosmonovaRnD\\Auth\\Repository\\UserRepository'\n                mappings:\n                    Auth:\n                        is_bundle: false\n                        type: annotation\n                        dir: '%kernel.project_dir%/vendor/cosmonova-rnd/auth/src/Entity'\n                        prefix: 'CosmonovaRnD\\Auth\\Entity'\n                        alias: Auth\n```\n\n3. Configure encoder and provider in `security` section\n\n```yml\nsecurity:\n    encoders:\n        CosmonovaRnD\\Auth\\Entity\\User:\n            algorithm: plaintext\n    providers:\n        auth_provider:\n            id: CosmonovaRnD\\Auth\\Security\\UserProvider\n```\n\n# Configuration of authentication through OAuth2 service (`authorization_code` flow)\n\n1. Configure your main firewall to use package provider and set login form config like bellow\n\n```yml\nsecurity:\n    firewalls:\n        main:\n            ### If you want to use OAuth2 Access Code authentication flow\n            provider: auth_provider\n            anonymous: ~\n            logout: ~\n            form_login:\n                login_path: auth\n                check_path: auth            \n```\n\n2. Add access control rules\n\n```yml\naccess_control:\n    - { path: ^/auth, roles: IS_AUTHENTICATED_ANONYMOUSLY }\n    - { path: ^/, roles: IS_AUTHENTICATED_FULLY }\n```\n\n# Configuration for checking authentication using JSON Web Token\n\nIn this case we use `Authorization: Bearer \u003cMY JWT\u003e` header\n\n1. Configure any provider (such like a `memory`)\n\n```yml\nsecurity:\n    providers:\n        in_memory: { memory: ~ }\n```\n\n2. Then add to your main firewall this provider and guard authenticator\n\n```yml\nsecurity:\n    firewalls:\n        main:\n            provider: in_memory\n            guard:\n                authenticators:\n                    - CosmonovaRnD\\Auth\\Security\\Authenticator\\JwtAuthenticator\n            stateless: true\n```\n\n3. Also configure your access rules if needed\n\n```yml\naccess_control:\n    - { path: ^/, roles: IS_AUTHENTICATED_FULLY }\n```\n\n### @ Cosmonova | Research \u0026 Development\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmonovarnd%2Fauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcosmonovarnd%2Fauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcosmonovarnd%2Fauth/lists"}