-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a50694
commit 5d2a394
Showing
23 changed files
with
232 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs/en/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
docs/en/creating-mfa-method-backend.md → ...methods/02_creating-mfa-method-backend.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: Creating new MFA methods | ||
--- | ||
|
||
# Creating new MFA methods | ||
|
||
[CHILDREN includeFolders] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,41 @@ | ||
# Data store interfaces | ||
|
||
Since the MFA architecture is largely designed to be decoupled, we use a `StoreInterface` implementation to retain | ||
data between requests. The default implementation for this interface is `SessionStore` which stores data using the | ||
Silverstripe CMS `Session` API provided by silverstripe/framework. | ||
Since the MFA architecture is largely designed to be decoupled, we use a [`StoreInterface`](api:SilverStripe\MFA\Store\StoreInterface) implementation to retain | ||
data between requests. The default implementation for this interface is [`SessionStore`](api:SilverStripe\MFA\Store\SessionStore) which stores data using the | ||
Silverstripe CMS [`Session`](api:SilverStripe\Control\Session) API provided by silverstripe/framework. | ||
|
||
If you need to use a different storage mechanism (e.g. Redis, DynamoDB etc) you can implement and configure your | ||
own `StoreInterface`, and register it with Injector: | ||
|
||
```yaml | ||
```yml | ||
SilverStripe\Core\Injector\Injector: | ||
SilverStripe\MFA\Store\StoreInterface: | ||
class: App\MFA\RedisStoreInterface | ||
``` | ||
Please note that the store should always be treated as a server side implementation. It's not a good idea to implement | ||
a client store e.g. cookies. | ||
> [!Note] | ||
> The store should always be treated as a server side implementation. It's not a good idea to implement | ||
> a client store e.g. cookies. | ||
## Adjusting what goes into the store | ||
By default, the entire HTTPRequest object is saved to the store during the multi-factor authentication process. We | ||
By default, the entire [`HTTPRequest`](api:SilverStripe\Control\HTTPRequest) object is saved to the store during the multi-factor authentication process. We | ||
exclude the `Password` field from the request by default, but if you need to exclude other fields, you can add an | ||
extension, for example: | ||
|
||
```php | ||
// Apply extension to \SilverStripe\MFA\Authenticator\LoginHandler | ||
// app/src/MFA/Extensions/MyLoginHandlerExtension.php | ||
namespace App\MFA\Extensions; | ||
use SilverStripe\Control\HTTPRequest; | ||
use SilverStripe\MFA\Store\StoreInterface; | ||
// Apply extension to SilverStripe\MFA\Authenticator\LoginHandler | ||
class MyLoginHandlerExtension extends Extension | ||
{ | ||
public function onBeforeSaveRequestToStore(HTTPRequest $request, StoreInterface $store): void | ||
{ | ||
$request->offsetUnset('MySecretField'); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.