How do I customize the ADFS 3.0 logout page to force sign out? - single-sign-on

We are using ADFS 3.0 with several apps as relying parties. When signing out from a web application the app redirects to:
https://fs.company.com/adfs/ls/idpinitiatedsignon.aspx
That page then has a Sign in button and a Sign Out button with two options:
Sign out from all the sites that you have accessed (selected)
Sign out from this site
The user selects one of those options and then clicks on the Sign Out button. Is it possible for us force the Sign Out button to be pressed (with the default option) so that the end user doesn't need to do anything?

Looks like I figured it out: the signout page loads a javascript file which can be modified (onload.js). I added a javascript function to that file which sends a click event to the signout button.
On the ADFS server open PowerShell. See the currently active web theme:
Get-AdfsWebConfig
This was set to Default. Then create a custom web theme based on the default web theme:
New-AdfsWebTheme -Name Custom -SourceName Default
Export the web theme for editing:
Export-AdfsWebTheme -Name Custom -DirectoryPath C:\temp
The file that needs to edited is: C:\temp\scripts\onload.js. Add these lines at the end (I got the ID of the Sign Out button by inspecting the source code of the signout page):
var signOutPanelExists = document.getElementById('idp_SignOutPanel');
if (signOutPanelExists)
{
// only click the SignOut button if it is displayed - to avoid endless loop
if (document.getElementById('idp_SignOutPanel').style.display != 'none')
{
var logoutKnopf = document.getElementById('idp_SignOutButton');
if (logoutKnopf)
{
window.onload = function(){ document.getElementById('idp_SignOutButton').click(); }
}
}
}
Upload the modified onload.js:
Set-AdfsWebTheme -TargetName Custom -AdditionalFileResource #{Uri='/adfs/portal/script/onload.js';path='C:\temp\script\onload.js'}
Activate the custom web theme:
set-adfswebconfig -ActiveThemeName Custom
Now when the user logs out of the web app he gets logged out completely w/o having to press another sign out button.
More info on editing the signin and signout page:
https://technet.microsoft.com/en-us/library/dn636121(v=ws.11).aspx

Related

Flutter Web Firebase Auth's persistence doesn't work on PWA

I have developed a Flutter Web app that uses Firebase Authentication in order to sign in users to the app.
I've declared the Firebase Authentication persistence field so that the app will remember and auto-login the user when he revisits the Flutter Web app's URL, and won't be required to re-login every time he launches the URL.
It all works fine on a regular browser, but when the user generates a PWA (for example, clicking "Add to Home Screen" on iOS devices to save the website as PWA), the persistence feature stops working, and the user is required to re-login every time he opens the PWA.
Is there a way to add Firebase Authentication's persistence feature to a PWA? And if not, is there a way to prevent generating a PWA (and saving the Flutter Web app as a regular browser URL when clicking "Add to Home Screen" button on iOS, for example)?
Thank you!
To solve the persistence problem, add a listener:
FirebaseAuth.instance.idTokenChanges().listen((User? user) async {
if (user == null) {
// Function for user not logged in here. Do not write function to change page here.
} else {
// As it's a Future it will take a while to process the user's information, so it
will call the function after it's done.
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => Home()));
}
}
This is an example I made and it worked, use controllers to change the status, put some function to wait for the information to be processed.
Hope this helps. Any questions, at your disposal.

Auth0 won't sign out using swift

I am using Auth0 library in my application but I have problems with sign out.
When i press the logout button the following code will be executed:
Auth0
.webAuth()
.clearSession(federated: true) { (Bool) in
A0SimpleKeychain.init(service: “Auth0”).clearAll()
SessionManager.shared.credentialsManager.clear()
}
This peace of code clears the session, keychain and credentials that are set and calls the backend. That url looks like this https://yourAuth0Application.com/v2/logout
When this is done I redirect back to login view where I can sign in again.
If i press the login button I want to see a view where i can re-enter my username and password, however they I am immediately signed in again.
When I open safari and go to https://yourAuth0Application.com/v2/logout then opening the app I am not signed in like it should. So I tried the same url in a web view and with a normal request inside the application but that does not seem to work.
The docs and community on the Auth0 website do not help me further at the moment.
Anyone here knows the correct implementation for sign out? Thanks. :)

How to redirect to home page in kentico after login in site intead Admin/cmsadministration.aspx?

I'm trying to redirect the users to home page after to log in. I've already added default target URL in the web part also in the template, I tried also by code
else if (!String.IsNullOrEmpty(DefaultTargetUrl))
{
redirectUrl = ResolveUrl("~/Compliance.aspx");
}
I also add a new domain alias with a default alias path but nothing is working.
Instead of using ~/admin as the login page, create your own ~/login page, that can be redirected to anywhere. If you use the default ~/admin it result to /CMSPages/logon.aspx?ReturnUrl=%2fKentico11%2fAdmin%2fcmsadministration.aspx which return URL is the Admin/cmsadministration.aspx

Cordova app check if user signed in before closing my app?

i'am trying to made cordova application that need user login to (google + or Facebook)
so i show button for sign in to (google+ or Facebook)
but after i close the app and open it again i need the sign in button hide depending on last signed in account
i need to know how i can check if user signed after closing my application?
ie check if user subscribe with data login to my app or no?
You can check this when your application gets loaded in
function onDeviceReady() {
// Now safe to use device APIs
//Create small function which check for is access toke valid or not
//which returns Boolean true or false
// Else you can use localStorage.isSignInned and once logged in set it as true.
if(isSignInned)
{
//hide buttons
}
}
You can check facebook javascript api here and google javascript api here
It depends upon how you want your application to work.
I am attaching working sample which i created for Facebook for GooglePlus
hope this helps.!

How to redirect the user to a custom page when user click "Connect to QuickBooks" button?

So Intuit charges for each active connections to QuickBooks. Therefore, I want to restrict the QuickBooks functionality in my application to premium users only.
Ideally when any user clicks the "Connect to QuickBooks" button and my RequestOAuthToken http handler is called, I want to check if the user is allowed to use QuickBooks. If that is the case, then the normal OAuth flow continue. If the user is NOT allowed, then I want to redirect the user to the upgrade page of my app.
Given that the "Connect to QuickBooks" button opens a new window (at least on desktop, I haven't tried on phone/tablets), the window should get closed, and the main window (my app) should redirect the user to the right page. And actually this is exactly what happens if the normal OAuth flow completes.
Now, I have tried a few different approaches but I couldn't get it working.
1) In my RequestOAuthToken, return a HTTP redirect to the plan page
2) In my RequestOAuthToken, return an html page with javascript logic to redirect to page
3) In my RequestOAuthToken, return HTTP redirect to a page with javascript logic to redirect to page
4) I haven't tried that one but could I somehow intercept the javascript click handler on the Intuit button. I'm not sure if that is an accepted practice.
Here is the piece a javascript I grabbed from the .Net sample:
try
{
var parentlocation = window.parent.opener.location.hostname;
var currentlocation = window.location.hostname;
if (parentlocation != currentlocation)
{
window.location = plansUrl;
}
else
{
window.opener.location.href = window.opener.location.href;
window.close();
}
}
catch (e)
{
window.location = plansUrl;
}
Help me out please.
I don't think you'll be able to do exactly what you're asking, but you can probably come close by taking a different approach.
Rather than trying to redirect them after they click the button, why not try to redirect them before they click it? e.g. when they try to get to the page that has the "Connect to QuickBooks" button it, check if they are a premium user there, and redirect them if they are not.
I don't think you'll be able to redirect them after they click the button because once they click that button, they get kicked over to Intuit's website and it's beyond your control at that point.
Clement, Keith has provided the answer we would want you to pursue. You may not alter the behavior of the Connect To QuickBooks button. It must be used as described in our documentation. Providing a link to a page that shows the Connect To QuickBooks buttons for your premium users and an upgrade message to non-premium users is the way to go.
I highly recommend that you visit http://docs.developer.intuit.com/0025_Intuit_Anywhere/0010_Getting_Started/0040_Publishing_Your_App and review all of the documentation there. If you develop with our guidelines and requirements in mind it will speed up the review process.
Tony Purmal
Developer Relations Engineer
Intuit Partner Platform