Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add recipes for eonx-com packages #912

Closed
wants to merge 2 commits into from
Closed
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
15 changes: 15 additions & 0 deletions eonx-com/easy-api-token/2.3/config/packages/easy_api_token.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
easy_api_token:
decoders:
chain:
list:
- user-apikey
- jwt-header

user-apikey: null
jwt-header:
driver: auth0
options:
allowed_algos: ['RS256']
authorized_iss: ['%auth0_token_issuer%']
private_key: ''
valid_audiences: ['%auth0_token_audience%']
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
easy_api_token:
decoders:
chain:
list:
- user-apikey
- jwt-header

user-apikey: null
jwt-header:
driver: firebase
options:
algo: 'HS256'
allowed_algos: ['HS256']
leeway: 1
param: 'sub'
private_key: 'my-key'
public_key: 'my-key'
13 changes: 13 additions & 0 deletions eonx-com/easy-api-token/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"bundles": {
"EonX\\EasyApiToken\\Bridge\\Symfony\\EasyApiTokenBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
},
"container": {
"auth0_placeholder_param": "",
"auth0_token_issuer": "%env(default:auth0_placeholder_param:AUTH0_TOKEN_ISSUER)%",
"auth0_token_audience": "%env(default:auth0_placeholder_param:AUTH0_TOKEN_AUDIENCE)%"
}
}
4 changes: 4 additions & 0 deletions eonx-com/easy-async/2.3/config/packages/easy_async.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
easy_async:
implementation: doctrine
jobs_table: easy_async_jobs
job_logs_table: easy_async_job_logs
8 changes: 8 additions & 0 deletions eonx-com/easy-async/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bundles": {
"EonX\\EasyAsync\\Bridge\\Symfony\\EasyAsyncBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
4 changes: 4 additions & 0 deletions eonx-com/easy-core/2.3/config/packages/easy_core.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
easy_core:
api_platform:
custom_pagination_enabled: true
simple_data_persister_enabled: true
8 changes: 8 additions & 0 deletions eonx-com/easy-core/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bundles": {
"EonX\\EasyCore\\Bridge\\Symfony\\EasyCoreBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
2 changes: 2 additions & 0 deletions eonx-com/easy-decision/2.3/config/packages/easy_decision.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
easy_decision:
use_expression_language: true
8 changes: 8 additions & 0 deletions eonx-com/easy-decision/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bundles": {
"EonX\\EasyDecision\\Bridge\\Symfony\\EasyDecisionBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
easy_pagination:
natepage marked this conversation as resolved.
Show resolved Hide resolved
resolver: in_query
start_size:
start_attribute: page
start_default: 1
size_attribute: perPage
size_default: 15
8 changes: 8 additions & 0 deletions eonx-com/easy-pagination/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"bundles": {
"EonX\\EasyPagination\\Bridge\\Symfony\\EasyPaginationBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/"
}
}
5 changes: 5 additions & 0 deletions eonx-com/easy-security/2.3/config/packages/easy_security.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
easy_security:
context_service_id: App\Security\Interfaces\ContextInterface
token_decoder: chain
permissions_locations:
- App\Security\Interfaces\PermissionsInterface
9 changes: 9 additions & 0 deletions eonx-com/easy-security/2.3/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bundles": {
"EonX\\EasySecurity\\Bridge\\Symfony\\EasySecurityBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}
15 changes: 15 additions & 0 deletions eonx-com/easy-security/2.3/src/Security/Context.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
declare(strict_types=1);

namespace App\Security;

use App\Security\Interfaces\ContextInterface;
use EonX\EasySecurity\Context as BaseContext;

/**
* When migrating to PHP7.4 this interface will be used to override return type hint for this app.
*/
final class Context extends BaseContext implements ContextInterface
{
// No body needed for now.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);

namespace App\Security\Factories;

use App\Security\Context;
use EonX\EasySecurity\Interfaces\ContextFactoryInterface;
use EonX\EasySecurity\Interfaces\ContextInterface;

final class ContextFactory implements ContextFactoryInterface
{
/**
* Create context.
*
* @return \EonX\EasySecurity\Interfaces\ContextInterface
*/
public function create(): ContextInterface
{
return new Context();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);

namespace App\Security\Interfaces;

use EonX\EasySecurity\Interfaces\ContextInterface as BaseContextInterface;

interface ContextInterface extends BaseContextInterface
{
// No body needed for now.
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace App\Security\Interfaces;

interface PermissionsInterface
{
// Define your permissions here...
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

namespace App\Security\Interfaces;

interface RolesInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these empty interfaces really be in the application? Don't they belong to your package?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nyholm Thank you for looking at the PR. The interfaces for roles and permissions are a "convention" we started to use to centralise the definition of roles/permissions in the application and also to allow these roles/permissions to be reused in the code in a consistent way.

The application doesn't have to use it but we recommend doing it this way, that's why we include these empty interfaces as part of the recipe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for being late to the party, but if you don't force to use this interface, which is fine, it should belong to the code repository and not the recipe

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OskarStark it's only been a few years it's ok 😄 Thank you for taking the time to look at it. I actually completely forgot about this PR so your comment reminded me of it, that's good.

We can actually close it, because since then we have migrated all our projects to using PHP for the application config, so these recipes are now irrelevant.

But once again, thanks for looking into it and bringing that back to my attention!

{
// Define your roles here...
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
declare(strict_types=1);

namespace App\Security\Providers;

use EonX\EasySecurity\RolesProviders\AbstractInMemoryRolesProvider;

final class InMemoryRolesProvider extends AbstractInMemoryRolesProvider
{
/**
* @return \EonX\EasySecurity\Interfaces\RoleInterface[]
*/
protected function initRoles(): array
{
return [
// Define your roles/permissions mapping here...
];
}
}