Comments (2)
Hmmm, so I guess this is the only block with the Result object available:
https://github.com/black-bits/laravel-cognito-auth/blob/master/src/Auth/CognitoGuard.php#L42-L63
Possibly a contract and trait could be created - which provides a method to temporarily store the result on the user object. In pseudo-code, something like:
protected function hasValidCredentials($user, $credentials)
{
...
if ($user instanceof CognitoAuthenticable) {
$user->setCognitoResult($result)
}
}
And then in your LoginController, usage would look like:
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
* @return mixed
*/
protected function authenticated(Request $request, $user)
{
$result = $user->getCognitoResult();
$accessToken = $result ? $result['AccessToken'] : null;
}
Alternatively, the result could be saved inside the guard? The only iffy thing about this, is IDEs wouldn't really understand auth()->cognitoResult()
and Auth::cognitoResult()
What do you think?
note: I'm not a maintainer here - but I'm certainly interested in this package and its future development
from laravel-cognito-auth.
Thanks @ryzr ! At first glance, that's definitely much better than my first, second, or third thought. I'll think on it for a little longer, and then I will probably go down your route.
from laravel-cognito-auth.
Related Issues (20)
- Laravel Framework 5.8.15 HOT 1
- Support username attributes use phone_number HOT 2
- Can this work localy? HOT 2
- Support for latest laravel (6.2.0)? HOT 2
- Laravel 7 support HOT 1
- How do I resend confirmation email? HOT 1
- Credentials issues when running on EC2/ECS instances HOT 1
- Authentication not working HOT 1
- The security token included in the request is invalid : need to know from where to pick up/generate AWS_COGNITO_KEY, AWS_COGNITO_SECRET from AWS account. HOT 1
- Traits missing.. HOT 1
- laravel 8 HOT 1
- Is there example implementation using this package ? HOT 2
- Trait method guard has not been applied, because there are collisions with other trait methods HOT 1
- Remove line 104 on CognitoClient HOT 1
- Remove the routes, views and translations and set it as an option in the setup, or make a vendor publishing HOT 5
- Composer dependencies unmet
- how it works with auth api
- MFA Support HOT 1
- [Help Wanted] SSO Without having to enter the credentials again.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-cognito-auth.