IdentityServer3 Login page add Application Name via IdentityServerOptions? - identityserver3

In identityServer3 using the default embedded login page I have set the SiteName to a custom value just fine.
I would like to have the default login page display the name of the client application that routed them to the login page... Is that possible or will I need to role my own page?
var options = new IdentityServerOptions
{
SiteName = "My Authenitcation Services",
SigningCertificate = SigningCertificate,
Factory = factory
};

To show a custom application name and such you need to override the partial view. IdentityServer3 Sample: EmbeddedAssetsViewService shows how to do this exactly.
Basicly...
In your identityServer Application add a templates folder in the site.
Copy their _login.html file and put inside this folder.
In your IdentityServerOptions set the SiteName = "What Ever you want",
The build and run your client application that pulls up the login page.
You should be good to go...
Finding the sample code example can be a bit difficult...
Where to download the sample code: [ link ]
Here is the sample code location in the samples download:
..\IdentityServer3.Samples-master\source\DefaultViewService\EmbeddedAssetsViewService

Related

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

Keycloak - direct user link registration

I have set up a web application with Keycloak in my local machine. Since Im using Keycloak as SSO implementation, I want in my web app that whenever SIGNUP button is click, user is directed into the registration page, and not going through the LOGIN page.
This is the example URL directed to the registration form, however, it contains a tab_id that is generated randomly like a session id.
https://site.test/auth/realms/custom/login-actions/authenticate?client_id=test&tab_id=qIdW92Bvwmk
I read about this link
Yes, as long as you use the "registrations" instead of "auth" in the
end of login ( AuthorizationEndpoint ) URL
But my endpoint in https://site.test/auth/realms/custom/.well-known/openid-configuration cannot be modified.
You can change the button link to this format -
http://<domain.com>/auth/realms/<realm-name>/protocol/openid-connect/registrations?client_id=<client_id>&response_type=code&scope=openid email&redirect_uri=http://<domain.com>/<redirect-path>&kc_locale=<two-digit-lang-code>
The registration page is exposed via an openid-connect endpoint, accessible in the same way as the standard auth screen. To construct the correct URL you can simply replace openid-connect/auth in the URL with openid-connect/registrations from the .well-known auth endpoint.
authEndpoint.replace("openid-connect/auth","openid-connect/registrations");
Using this endpoint the user will be directed to the registration screen instead of the login screen.
It is not documented or exposed via .well-known/openid-configuration, but you can see it in the source code:
public static UriBuilder registrationsUrl(UriBuilder baseUriBuilder) {
UriBuilder uriBuilder = tokenServiceBaseUrl(baseUriBuilder);
return uriBuilder.path(OIDCLoginProtocolService.class, "registrations");
}
For Keycloak 17 this worked for me:
http://<mykeycloakdomain.com>/realms//protocol/openid-connect/registrations?client_id=<myclient_id>&response_type=code&scope=openid+email&redirect_uri=https%3A%2F%2Fmywebsiteurl.com&kc_locale=

unable to load two page on same url using atmosphere in jhipster version 1.0.0

I have updated my project to the latest version of jhipster, that is 1.0.0 . In my project I am opening 2 different pages on the same url depending on user is logged in or not, that is, if user is logged in then home page is requested else index page is requested. When web socket with atmosphere framework is not used in this latest version jhipster project, it works fine but in case when web socket with atmosphere framework is used there are 2 cases:
First case is that when user presses the enter button or F5 button to refresh the page, it does not enter to the StaticResourcesProductionFilter due to which our mapping is not bind i.e i have set our code in StaticResourcesProductionFilter file.
Second case is when the user presses the Ctrl+F5 buttons to refresh the page, it enters the static resources and it works fine.
our code for mapping is :
if ("/".equals(requestURI)) {
//System.out.println("requestURI"+requestURI);
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
String name = auth.getName();
if(name.equals("anonymousUser")){
requestURI = "/index.html";
}
else{
requestURI = "/home.html";
}
}
But i want to use my project web socket with atmosphere framework and in every case. Please help to find the solution for it so that I can use web socket as well as open 2 different pages on same url depending on user is logged in or not.

how can I test my facebook page tab app from localhost

I'm developing a facebook page tab app. When I set page tab URL in app settings to something like localhost/fbapp, it doesn't work since the page tab is not simply iframe. Is there any workaround to resolve this?
EDIT
I'm building facebook page tab with ASP.NET MVC-3.0 with fb C# SDK.
What I've tried so far is to modify hosts file to point the URL I have on app settings to localhost(127.0.0.1). I've been testing facebook app in this way always but it doesn't work in facebook page tab.
In Application setting in page tab url set
http://localhost/yourpagetabdir/
I am using this setting for my page application test frmlocalhost its works fine from my ASP.Net Development server if you are using IIS server make sure your IIS server allow page in iframe.
after this if u want to get page-signed request
Facebook.FacebookConfigurationSection s = new FacebookConfigurationSection();
s.AppId = "AppID";
s.AppSecret = "Secret";
FacebookWebContext wc = new FacebookWebContext(s);
dynamic da = wc.SignedRequest.Data;
dynamic page = da.page;
string curpageid = page.id;
bool isLiked = page.liked;
bool isAdmin = page.admin;
Try editing your hosts file so that when you go to http://example.com it links to your http://localhost/yourapp
Here's how to do it:
Windows: http://www.trailheadinteractive.com/creating_multiple_virtual_sites_a_single_apache_install_windows_xp (your localhost URL should have a valid website format: 127.0.0.1 dummydomainname.tld)
MacOS: http://danilo.ariadoss.com/how-to-setup-virtual-hosts-mamp-environment/ (again, make sure you have a valid website format)
Linux: You probably know how to do this already :)
This should work as then the iframe would point to a valid URL, which on your local machine would point to your content. Note that this won't work if you access the tab from other computers since for them the URL would point to something else (or nothing, depending on what domain name you choose).
Using FB PHP SDK for example, you can post the signed_request and parse it with a few lines:-
require_once ("facebook.php"); // this file comes from the SDK
$config = array();
$config['appId'] = 'get_appID_from_app_menu';
$config['secret'] = 'get_secret_below_appID';
$facebook = new Facebook($config);
$signed_request = $facebook->getSignedRequest();
print_r($signed_request);
Avoid that lenghty example given in FB's blog. Good luck coding :)
I figured out the issue with facebook page tab. It seems that they don't accept http on page tab even I have sandbox mode enabled. All I have to do is set up IIS to work with https and run the app over the ssl. It is now working perfectly. Thank you guys for all help

Extended Permissions for Facebook MVC C#

I'm trying to get all the photos from a user's profile and i need to add that to the extended permissions of my Facebook MVC C# app.
I've tried using the following code below but i can't get it to work, i just get:
"This webpage has a redirect loop"
Does anyone have any ideas on how to add extended permissions?
[FacebookAuthorize(LoginUrl = "/Account/Login", Permissions = "user_photos")]
public ActionResult Profile()
{
var client = new FacebookWebClient();
dynamic photos = client.Get("me/photos");
dynamic me = client.Get("me/photos");
ViewBag.Name = me.name;
ViewBag.Id = me.id;
return View();
}
I'd like someone to correct me if i'm not right, but, extended permissions are specified either on the login button, or the permissions button.
For example, I have the login button on my Default.aspx page:
<fvk:loginbutton id ="loginbutton1" runat="server" OnConnectCalled="OnLogin" Permissions="email,user_birthday,publish_stream,user_photos" Size="small" />
That is where I specify what permissions my app needs. And after that I can specify inside my code, what info I need to retrieve in a specific moment. Default.aspx.cs.
var client = new FacebookWebClient();
dynamic photos = client.Get("me/photos");
dynamic me = client.Get("me/photos");
ViewBag.Name = me.name;
ViewBag.Id = me.id;
This way, when the user first logs into your app, he gives the requested permissions. Then afterwards, you can use his info / photos anyway you want in your code.
I just did that exact same thing using this:
[CanvasAuthorize(Permissions = "user_photos,publish_stream", CancelUrlPath = "/Home/NoPermission", ReturnUrlPath = "/Photos/Upload")]
I'm not sure the difference between FacebookAuthorize and CanvasAuthorize. What might help is setting the REturnUrlPath. I did it because I'm working locally on a virtual directory and it wasn't redirecting correctly after authentication.

Categories