Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
prwater committed Sep 25, 2024
0 parents commit e033ef6
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/README.md export-ignore
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/.idea/
/composer.lock
/vendor/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Set Based IT Consultancy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# PhpPlaisio: Trusted Host Authority

<table>
<thead>
<tr>
<th>Social</th>
<th>Legal</th>
<th>Release</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://gitter.im/PhpPlaisio/PhpPlaisio"><img src="https://badges.gitter.im/PhpPlaisio/PhpPlaisio.svg" alt="Gitter"/></a>
</td>
<td>
<a href="https://packagist.org/packages/plaisio/trusted-host-authority"><img src="https://poser.pugx.org/plaisio/trusted-host-authority/license" alt="License"/></a>
</td>
<td>
<a href="https://packagist.org/packages/plaisio/trusted-host-authority"><img src="https://poser.pugx.org/plaisio/trusted-host-authority/v/stable" alt="Latest Stable Version"/></a>
</td>
</tr>
</tbody>
</table>

Interface for determining whether a remote host (i.e. the next hop) is a trusted host.

# Design

This is an [abstract, responsible and stable package](https://matthiasnoback.nl/book/principles-of-package-design/).
Hence, if you see little or non-recent activity in this repository it doesn't mean this projects is dead, but it means
we have achieved one of the essentials goals of this package.

# License

This project is licensed under the MIT license.
19 changes: 19 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "plaisio/trusted-host-authority",
"description": "PhpPlaisio: Trusted Host Authority",
"keywords": [
"PhpPlaisio",
"Trusted",
"Host",
"Authority"
],
"license": "MIT",
"require": {
"php": ">=8.1"
},
"autoload": {
"psr-4": {
"Plaisio\\TrustedHostAuthority\\": "src/"
}
}
}
9 changes: 9 additions & 0 deletions plaisio-kernel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<kernel>
<properties>
<property>
<type>\Plaisio\TrustedHostAuthority\TrustedHostAuthority</type>
<name>trustedHostAuthority</name>
<description>The object for determining whether the remote host (i.e. the next hop) is a trusted host.</description>
</property>
</properties>
</kernel>
27 changes: 27 additions & 0 deletions src/TrustedHostAuthority.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);

namespace Plaisio\TrustedHostAuthority;

/**
* Interface for determining whether a remote host (i.e. the next hop) is a trusted host.
*
* A concrete implementation must always decide the remote host is NOT a trusted host, unless the remote host is trusted
* reverse proxy.
*/
interface TrustedHostAuthority
{
//--------------------------------------------------------------------------------------------------------------------
/**
* Returns whether the remote host (i.e. the next hop) is a trusted host.
*
* @param string $ip The IP address of the remote host.
*
* @return bool
*/
public function isTrustedHost(string $ip): bool;

//--------------------------------------------------------------------------------------------------------------------
}

//----------------------------------------------------------------------------------------------------------------------

0 comments on commit e033ef6

Please sign in to comment.