league/oauth2-server
Standards-compliant OAuth 2.0 authorization server for PHP. Protect APIs with bearer access tokens, issue and refresh tokens, and support common grants (auth code, client credentials, device, implicit, password, refresh) with PSR-7 interoperability and RFC support.
supportsGrantType to allow the auth server to issue the response unauthorized_client when applicable (PR #1420)slow_down error happens, because the exception is thrown before calling persistDeviceCode. (PR #1410)slow_down error response may have been returned even after the user has completed the auth flow (already approved / denied the request). (PR #1410)RequestAccessTokenEvent and RequestRefreshTokenEvent events instead of the general RequestEvent event when an access / refresh token is issued using device authorization grant. (PR #1467)invalid_scope error response and wasn't on fragment part of access_denied redirect URI on Implicit grant (PR #1298)revokeRefreshTokens(false) unintentionally disables issuing new refresh token (PR #1449)revokeRefreshTokens() for enabling or disabling refresh tokens after use (PR #1375)getKeyContents() to the CryptKeyInterface (PR #1375)invalid_grant error and a HTTP 400 response. In previous versions the server incorrectly issued an invalid_request and HTTP 401 response (PR #1042) (PR #1082)createAuthorizationRequest() (PR #1111)finalizeScopes() to allow a reference to an auth code ID (PR #1112)toString() instead of the magic method __toString() (PR #1395)revokeRefreshTokens() for enabling or disabling refresh tokens after use (PR #1375)getKeyContents() to the CryptKeyInterface (PR #1375)invalid_grant error and a HTTP 400 response. In previous versions the server incorrectly issued an invalid_request and HTTP 401 response (PR #1042) (PR #1082)createAuthorizationRequest() (PR #1111)finalizeScopes() to allow a reference to an auth code ID (PR #1112)toString() instead of the magic method __toString() (PR #1395)LocalFileReference() in lcobucci/jwt. Function deprecated as per GHSA-7322-jrq4-x5hf (PR #1249)StrictValidAt() method in lcobucci/jwt so we can use version 4.1.x or greater of the library (PR #1236)revokeRefreshTokens() function to decide whether refresh tokens are revoked or not upon use (PR #1189)openssl_pkey_get_private() and openssl_pkey_get_public() instead of regex matching (PR #1215)empty() check (PR #1181)getRedirectUri function to the OAuthServerException class (PR #1123)code_challenged changed to code_challenge. Thrown by Auth Code Grant when the code challenge does not match the regex. (PR #1130)preg_match() to validate an RSA key, the server will now throw a RuntimeException (PR #1047)Lcobucci\JWT\Builder to build a JWT token. (PR #1060)getIdentifier() added to AccessTokenTrait. The trait cannot be used without the getIdentifier()
method being defined (PR #1051)To address feedback from the security release the following change has been made:
AuthorizationServer constructor now expects an encryption key string instead of a public keyAuthorizationServer instance you set the setEncryptionKey(). This will result in stronger encryption being used. If this method is not set messages will be sent to the defined error handling routines (using error_log). Please see the examples and documentation for examples.finalizeScopes call (Issue #650)array_shift with foreach loop (Issue #621)isExpired() method from entity interfaces and traits (Issue #600)paragonie/random_compat 2.x (Issue #606)indigophp/hash-compat to Composer suggestions and require-dev for PHP 5.5 supportResource owner to terminology.md (Issue #561)state parameter is now correctly returned after implicit grant authorizationVersion 5 is a complete code rewrite.
Version 5 is a complete code rewrite.
hash_hmac() should output raw binary data, not hexits (Issue #370).travis.yml updatessymfony/http-foundation dependency version to ~2.4 so package can be installed in Laravel 4.1.*getScopeDelimiter() and setScopeDelimiter() methods have been renamedgetallheaders() is available (Issues #108 and #114)$this to support method chainingisValid() flag to check for Authorization header only (thanks @alexmcroberts)requireScopeParam() and requireStateParam() by changing their default value to truerotateRefreshTokens(). Pass in true to issue a new refresh token each time an access token is refreshed. This parameter needs to be set to true in order to request reduced scopes with the new access token. (Issue #47)key column in oauth_scopes table to scope as key is a reserved SQL word. (Issue #45)scope parameter is no longer required by default as per the RFC. (Issue #43)setDefaultScope(). (Issue #42)oauth_session_token_scopes table primary keyDEFAULT '' that has slipped into some tablesSessionInterface::associateRefreshToken()null as default parameters in some methods in the storage interfacesIf you're upgrading from v1.0.8 there are lots of breaking changes
requireStateParam()requireScopeParam()state parameter request to the checkAuthoriseParams() method.self::getParam()requireCodeChallengeForPublicClients, used to reject public clients that do not provide a code challenge for the Auth Code Grant; use AuthCodeGrant::disableRequireCodeCallengeForPublicClients() to turn off this requirement (PR #938)isConfidential getter added to ClientEntity to identify type of client (PR #938)validateClient() added to validate clients which was previously performed by the getClientEntity() function (PR #938)getClientEntityOrFail(). This is a wrapper around the getClientEntity() function that ensures we emit and throw an exception if the repo doesn't return a client entity. (PR #1010)convertToJWT() interface with a more generic __toString() to improve extensibility; AccessTokenEntityInterface now requires setPrivateKey(CryptKey $privateKey) so __toString() has everything it needs to work (PR #874)invalidClient() function accepts a PSR-7 compliant $serverRequest argument to avoid accessing the $_SERVER global variable and improve testing (PR #899)issueAccessToken() in the Abstract Grant no longer sets access token client, user ID or scopes. These values should already have been set when calling getNewToken() (PR #919)enableCodeExchangeProof flag. Any client sending a code challenge will initiate PKCE checks. (PR #938)getClientEntity() no longer performs client validation (PR #938)DateTimeImmutable() instead of DateTime(), time() instead of (new DateTime())->getTimeStamp(), and DateTime::getTimeStamp() instead of DateTime::format('U') (PR #963)enableCodeExchangeProof flag (PR #938)error_description to the error payload to improve standards compliance. The contents of this are copied from the existing message value. (PR #1006)message value in the next major release (PR #1006)getResponseType() function instead of AuthorizationServer constructor (PR #969)finalizeScopes() call from validateAuthorizationRequest method to the completeAuthorizationRequest method so it is called just before the access token is issued (PR #923)validateRedirectUri method AbstractGrant to remove three instances of code duplication (PR #912)hasRedirect() added to OAuthServerException (PR #703)BadMethodCallException from the verify() method of the JWT token in the validateAuthorization method (PR #904)empty() function call only contains variable to be compatible with PHP 5.4 (PR #918)How can I help you explore Laravel packages today?