{"id":20103153,"url":"https://github.com/dotkernel/dot-authentication","last_synced_at":"2025-07-10T02:37:37.733Z","repository":{"id":11022696,"uuid":"68028956","full_name":"dotkernel/dot-authentication","owner":"dotkernel","description":"DotKernel component defining authentication abstractions","archived":false,"fork":false,"pushed_at":"2025-03-05T10:27:06.000Z","size":119,"stargazers_count":3,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"2.0","last_synced_at":"2025-06-17T03:43:25.373Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.dotkernel.org/dot-authentication/","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/dotkernel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-12T16:55:08.000Z","updated_at":"2025-03-05T10:27:10.000Z","dependencies_parsed_at":"2024-05-03T18:40:10.213Z","dependency_job_id":"49cca39f-881a-4dc4-88f5-94adf3deb639","html_url":"https://github.com/dotkernel/dot-authentication","commit_stats":{"total_commits":17,"total_committers":5,"mean_commits":3.4,"dds":0.2941176470588235,"last_synced_commit":"c38cadf7a0ef8fdedb452874fd65b926f755da71"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/dotkernel/dot-authentication","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authentication","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authentication/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authentication/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authentication/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotkernel","download_url":"https://codeload.github.com/dotkernel/dot-authentication/tar.gz/refs/heads/2.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotkernel%2Fdot-authentication/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264519719,"owners_count":23621858,"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":[],"created_at":"2024-11-13T17:34:28.394Z","updated_at":"2025-07-10T02:37:37.718Z","avatar_url":"https://github.com/dotkernel.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dot-authentication\n\nCore interfaces for authentication implementations.\n\n`dot-authentication` is Dotkernel's authentication base package which define interfaces for authentication services to be used with Dotkernel applications.\n\n## Documentation\n\nDocumentation is available at: https://docs.dotkernel.org/dot-authentication/.\n\n## Badges\n\n![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-authentication)\n![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-authentication/2.6.0)\n\n[![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-authentication)](https://github.com/dotkernel/dot-authentication/issues)\n[![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-authentication)](https://github.com/dotkernel/dot-authentication/network)\n[![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-authentication)](https://github.com/dotkernel/dot-authentication/stargazers)\n[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-authentication)](https://github.com/dotkernel/dot-authentication/blob/2.0/LICENSE.md)\n\n[![Build Static](https://github.com/dotkernel/dot-authentication/actions/workflows/continuous-integration.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-authentication/actions/workflows/continuous-integration.yml)\n[![codecov](https://codecov.io/gh/dotkernel/dot-authentication/graph/badge.svg?token=ZBZDEA3LY8)](https://codecov.io/gh/dotkernel/dot-authentication)\n[![PHPStan](https://github.com/dotkernel/dot-authentication/actions/workflows/static-analysis.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-authentication/actions/workflows/static-analysis.yml)\n\n## Installation\n\nRun the following command in you project directory\n\n```shell\ncomposer require dotkernel/dot-authentication\n```\n\nPlease note that usually this package will be installed as a dependency to a concrete implementation, so usually you won't need to add this to you project manually.\n\n## AuthenticationInterface\n\nDefines the interface that should be implemented by any authentication service, in order to work with Dotkernel applications.\nThis is a result of the fact that the default packages used by Dotkernel applications, that need access to the authentication service are type-hinted against this interface.\n\nAlso, concrete implementations should be registered in the service manager using this interface's FQN.\n\n### Methods\n\n```php\npublic function authenticate(ServerRequestInterface $request): AuthenticationResult;\n```\n\nThis method is the implementation of the actual authentication process.\n\nIt should extract credentials from the `$request` object (Authorization header, custom request attributes etc.).\nIt should return an `AuthenticationResult` object, defined in this package, which carry the authentication status and identity on success.\n\n```php\npublic function challenge(ServerRequestInterface $request): ResponseInterface;\n```\n\nThis method should return a valid  PSR-7 `ResponseInterface` used to notify the client or browser that it needs to authenticate first(usually using the `WWW-Authenticate` header - useful for HTTP basic and digest authentication).\n\n```php\npublic function hasIdentity(): bool;\npublic function getIdentity(): ?IdentityInterface;\npublic function setIdentity(IdentityInterface $identity);\npublic function clearIdentity();\n```\n\nThese methods are used to check if authenticated, get the authenticated identity object, force set an identity(maybe useful for auto-login) or clear an identity(logout)\n\n## IdentityInterface\n\nYou can use any object to represent an authenticated identity(user) as long as it implements this interface.\nIt requires 2 methods, `getId()` which should return the unique identifier of the identity, and `getName(): string` which should return a string representation of the identity(for display purposes, usually the email or username).\n\n## AuthenticationResult\n\nReturned by the authentication service, on authentication success or failure.\nIt composes one of the predefined authentication codes, which describes the authentication status, an error message in case the authentication has failed, and the identity object on success.\n\n## UnauthorizedException\n\nException to be thrown when accessing content that need authentication first.\nThis can be used within an application to trigger an error and do a custom action(like redirecting to a login page).\nThere is not a predefined way to handle this, Dotkernel packages use this exception paired with a custom error handler to handle unauthorized errors.\nWhen using the frontend or admin applications, this is already setup among the authentication/authorization packages, and throwing an UnauthorizedException from anywhere your application, it will redirect to the login page by default.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-authentication","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotkernel%2Fdot-authentication","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotkernel%2Fdot-authentication/lists"}