Skip to content
This repository was archived by the owner on Mar 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ build
/.project
/deployment.properties
/deployment.xml
test/asset/orm-autoload/oauth2.doctrine-orm.global.php
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ This provides a Doctrine adapter for [zfcampus/zf-mvc-auth](https://github.com/z
Versions
--------

The Version 1.x series is for PHP 5.5 to 7.0. The 2.x series is for PHP 7.1 onward.
* 1.x series is for PHP 5.5 to 7.0.
* 2.x series is for PHP 7.1 onward.
* 3.x series is for PHP 7.1 onward and uses bigint instead of integer, scope fixture, and bcrypt cost of 10.

![Entity Relationship Diagram](https://raw.githubusercontent.com/API-Skeletons/zf-oauth2-doctrine/master/media/oauth2-doctrine-erd.png)
Entity Relationship Diagram created with [Skipper](https://skipper18.com)
Expand Down
28 changes: 14 additions & 14 deletions config/oauth2.doctrine-orm.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ return array(
'event_manager' => 'doctrine.eventmanager.orm_default',
'driver' => 'doctrine.driver.orm_default',
'enable_default_entities' => true,
'bcrypt_cost' => 14, # match zfcuser
'bcrypt_cost' => 10, # match php default
'auth_identity_fields' => array('username'),
// Dynamically map the user_entity to the client_entity
'dynamic_mapping' => array(
Expand Down Expand Up @@ -72,7 +72,7 @@ return array(
'user_id' => array(
'type' => 'field',
'name' => 'id',
'datatype' => 'integer',
'datatype' => 'bigint',
),
'username' => array(
'type' => 'field',
Expand All @@ -93,7 +93,7 @@ return array(
'client_id' => array(
'type' => 'field',
'name' => 'clientId',
'datatype' => 'integer',
'datatype' => 'string',
),
'client_secret' => array(
'type' => 'field',
Expand Down Expand Up @@ -121,7 +121,7 @@ return array(
'name' => 'user',
'entity_field_name' => 'id',
'entity' => $userEntity,
'datatype' => 'integer',
'datatype' => 'bigint',
'allow_null' => true,
),
),
Expand Down Expand Up @@ -151,14 +151,14 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
'user_id' => array(
'type' => 'relation',
'name' => 'user',
'entity_field_name' => 'id',
'entity' => $userEntity,
'datatype' => 'integer',
'datatype' => 'bigint',
'allow_null' => true,
),
),
Expand Down Expand Up @@ -188,14 +188,14 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
'user_id' => array(
'type' => 'relation',
'name' => 'user',
'entity_field_name' => 'id',
'entity' => $userEntity,
'datatype' => 'integer',
'datatype' => 'bigint',
'allow_null' => true,
),
),
Expand Down Expand Up @@ -235,14 +235,14 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
'user_id' => array(
'type' => 'relation',
'name' => 'user',
'entity_field_name' => 'id',
'entity' => $userEntity,
'datatype' => 'integer',
'datatype' => 'bigint',
'allow_null' => true,
),
),
Expand All @@ -266,7 +266,7 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
),
),
Expand Down Expand Up @@ -299,7 +299,7 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
),
),
Expand All @@ -322,7 +322,7 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
),
),
Expand Down Expand Up @@ -350,7 +350,7 @@ return array(
'name' => 'client',
'entity_field_name' => 'clientId',
'entity' => 'ZF\OAuth2\Doctrine\Entity\Client',
'datatype' => 'integer',
'datatype' => 'bigint',
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.AccessToken.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\AccessToken" table="AccessToken_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="accessToken" type="text" nullable="true"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\AuthorizationCode" table="AuthorizationCode_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="authorizationCode" type="string" nullable="true"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.Client.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\Client" table="Client_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="clientId" type="string" nullable="true"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.Jti.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\Jti" table="Jti_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="subject" type="string" nullable="true"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.Jwt.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\Jwt" table="Jwt_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="subject" type="string" nullable="true"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.PublicKey.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\PublicKey" table="PublicKey_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="publicKey" type="text" nullable="true"/>
Expand Down
2 changes: 1 addition & 1 deletion config/orm/ZF.OAuth2.Doctrine.Entity.RefreshToken.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\RefreshToken" table="RefreshToken_OAuth2">
<id name="id" type="integer">
<id name="id" type="bigint">
<generator strategy="AUTO"/>
</id>
<field name="refreshToken" type="string" nullable="true"/>
Expand Down
12 changes: 5 additions & 7 deletions config/orm/ZF.OAuth2.Doctrine.Entity.Scope.dcm.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="ZF\OAuth2\Doctrine\Entity\Scope" table="Scope_OAuth2">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>
<id name="id" type="bigint"/>
<field name="scope" type="text" nullable="true"/>
<field name="isDefault" type="boolean" nullable="true"/>
<many-to-many field="client" target-entity="ZF\OAuth2\Doctrine\Entity\Client" inversed-by="scope">
<join-table name="ClientToScope_OAuth2">
<join-columns>
<join-column name="scope_id" referenced-column-name="id" nullable="false"/>
<join-column name="scope_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="client_id" referenced-column-name="id" nullable="false"/>
<join-column name="client_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>
<many-to-many field="authorizationCode" target-entity="ZF\OAuth2\Doctrine\Entity\AuthorizationCode" inversed-by="scope">
<join-table name="AuthorizationCodeToScope_OAuth2">
<join-columns>
<join-column name="scope_id" referenced-column-name="id" nullable="false"/>
<join-column name="scope_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</join-columns>
<inverse-join-columns>
<join-column name="authorization_code_id" referenced-column-name="id" nullable="false"/>
<join-column name="authorization_code_id" referenced-column-name="id" nullable="false" on-delete="CASCADE"/>
</inverse-join-columns>
</join-table>
</many-to-many>
Expand Down
Loading