I have built an application that uses local auth, I want if a user does not use the software for a long time (whether web or mobile app) I can detect it and take it to the password login page.
I try to use RouteObserver and I write a custom observer but is not good for navigation, it good for log and track.
medium
I know it's possible to add conditions before all my Navigator.push(), but I'm looking for a way to add middleware to all my routes.
use onGenerateRoute named parameter of 'MaterialApp` Widget.
Related
In integration test ca i do the following?,
Is it possible to run integration test with apps having this kind of flow:
app starts -> splash screen-> ad with close button -> amplify auth login screen -> home -> menu home buttons -> another screen so and so..?
Run integration test bypass login screen and do integration test to specific part of the app only
It is, but you'll have to make sure that you can stub/mock all "external" components, the ones you don't really have control over (eg: external ad server, authentication service, ...). You need to be able to take control over these in order to decide for yourself which possible scenario's will play out (eg: ad doesn't load, authentication failed, ...) and also to avoid being dependent on those external components while running your tests. Your best bet is to make sure that you can inject mock versions of the required services and widgets into your application. This might take some refactoring at first, but in the end it should result in clean and better testable code.
Personally, I'm using firebase_auth for authentication. In the setUp of your integration tests, you can then "pretend" the user is already authenticated through the use of MockFirebaseAuth (see firebase_auth_mocks). The idea is the same as in point 1; the firebase authentication service is being mocked, and will just provide the type of User object that you want it to, which would probably be a successfully authenticated user in most cases.
Edit: your app should be set up in such a way that it will first check whether or not the user is already authenticated. If so, just skip the login screen. This way, when the authentication service provides an already authenticated user, the login screen will be bypassed and you can continue testing the rest of your app without having to fill in credentials every single time...
What I have come up with till now is to manually override methods like window.open, window.postMessage and window.onmessage to internally create a bridge within Dart.
Is there a standard approach to solve this?
I found the answer on a medium post under the heading: How to manage popup windows opened with target=”_blank” or “window.open”.
The key is to implement the onCreateWindow method and create another InAppWebView instance with the windowId received from CreateWindowAction.
Most API providers prohibit the use of webviews for Oauth because of security concerns. Providers require the use of an external browser to execute authorization of username and password. With Android, you must register a Callback activity in your manifest for the provider to direct the user to after authorization is complete and the browser closes.
You can look at oauth2_flutter to see how the author of that library handled the callback and how to configure it.
I have a Flutter app which holds a username and a token to communicate with a web service.
How can I manage the username and token efficiently using best practices? Currently I am writing them into a DB and select them each time I want to do a request.
I tried to use bloc provider flutter bloc with a BlocProvider. I have the states LoggedIn and LoggedOut and the events Login and Logout.
Furthermore, I had a look at
secure storage, but I can't get the data available throughout all pages.
Also, I am not using the firebase API.
Let me know if I should provide some code snippets.
I use SharedPreferences now. The API is very simple and I wrote a wrapper to get rid of the (Strings) keys. Furthermore, the wrapper holds the values for the current session. The advantage of that is, that I can address the values directly instead of needing to read them asynchronously.
I have 2 provider, general provider and blog provider. general provider is called on splash screen and here I normally call API that fetch most common data like blog, category, tags, notification and is stored in general provider. How can I use the same data and populate other provider from the 'general provider' itself ? reason to do so is save number of calls made on the start of the app.
I want to use IdentityServer3 in my solution, but one of my requirements is to connect to multiple databases for users, clients and scopes.
So, I want to customize the Login page and add a database selector. I’m doing this with a custom view service.
Then, when the user click on login button, my custom user service is called, but I don’t know how to send the database selector value to my AuthenticateLocal implementation on custom user service.
I need to know the database selector value in custom client and scope services as well.
I saw this post: http://forums.asp.net/t/2032044.aspx?Custom+User+Service+for+Thinktecture+Identity+Server+V3 where Brock said it isn’t possible.
Does the latest version of IdentityServer3 have any way to archive what I need?
Thanks!
Best regards.
You can add custom form elements to the submit on the login page. In your custom IUserService add the OwinEnvironmentService as a ctor dependency to get access to the incoming OWIN environment. You can then wrap that with an OwinContext for convenience. Then in your AuthenticateLocal you can read the posted custom form elements to do whatever you need in your logic.