OAuth2 client - redirect url not allow localhost - java

Creating a Springboot oauth2 client to integrate an OIDC provider login in the application.
But the OIDC provider not allowing redirect URLs (working on authorization code flow) with the format of http://localhost: or http://localhost
So every time I want to deploy the code changes to the server to check its working and not able to debug in my development environment.
I'm using my company-provided machine for the development, which not allow to install ngrok.
Can someone please help me to find a way to do the development and debug in my dev machine.

Related

Unable to view the Login Page on keycloak

I am working over integration of React application with KeyCloak. I have installed the keycloak server version 11.0.2 over my local machine. I am able to access the administrative login and create the admin user. I have also created a custom client and user with credentials using the keycloak. My react application is hosted over port 9000 of my machine and keycloak over 8080 (default) port. Now, when I am redirecting to my application URL it is automatically redirecting to the below url:
http://localhost:8080/auth/realms/{Custom_realm}/protocol/openid-connect/auth?client_id={Custom_Client}&redirect_uri=http%3A%2F%2Flocalhost%3A9000%2F&state=r8yy83fdgd-27f8-4aa9-a679-01sfdsgd9&response_mode=fragment&response_type=code&scope=openid&nonce=27fedfgf89-66be-4484-bbcc-aabb4saddc4
The url is rendering We are Sorry and not allowing me to enter the credentials required for the user.
Not sure why is the login page not landing.
Can anyone help me out with this?? Also provide the basic level of configurations required for Keycloak for integrating it with the application and creating a new Realm and client.
Issue was resolved. There was a mismatch of the Realm name in the code as well as the one created in Keycloak. In Keycloak I created UI_Realm while in code it was written as UI_realm

How automatically log in with Windows credentials in java?

I want to automatically authenticate, 'active directory users', which are logged in to their windows, in my applications.
in short, i want SSO for my applications using windows credentials.
**Client is React and back-end is Java 8 and Spring 4.1.2 and Spring Security is 3.2.5.
I already authenticate and search 'active directory users' in my applications, using spring LDAP 3.2.5.
but users should submit their username and password when they use browser.
I have read about 'Integrated Windows Authentication' (IWA), 'Kerberos', 'NTLM'.
should I use NTLM instead of LDAP ???
or, should I use Kerberos ???
or, should I use ADFS ???
should I config anything in active directory for that ???
**I cant config anything in active directory
should I get windows credentials programmatically in react and send it to server and from server I should send that credentials to active directory to verify it ???
I don't know but, should I say any thing in my 'HTTP response' to 'HTTP OPTION Request' to force browser to set windows credentials in next request ??
and, thanks for your time.
There are a couple ways to do this:
Windows Authentication
This is best for the user as it is a seamless login. If the website is trusted, then the browser will automatically send the credentials of the currently-logged-on user to the site.
In this case, the web server (Tomcat in this case) handles the authentication and passes the credentials to the application. If you were using IIS and Windows, the setup would be super easy. But with Tomcat on Linux, it's a little harder. You need to setup kerberos, which requires setting up SPN (Service Principal Name) values on the domain so that your server is trusted on your domain to authenticate. The full instructions for setting this up in Tomcat 8 are here: Windows Authentication How-To
Once that is setup, your website needs to be trusted by the browsers. If your site is recognized as an intranet site, then this should already be true. If not, then your site's domain needs to be added to the Trusted Sites in the Internet Options on the client computers. This can also be done via Group Policy. That will work for IE and Chrome. Firefox uses its own network.negotiate-auth.delegation-uris setting.
Forms Authentication
Another way is to use a login page to ask the user for their username and password, then authenticate them via LDAP in your Java application code. I will assume you know how to setup a login page, so you just need to know how to verify the credentials. You can use the answer here for that code. That answer has the code in a console app, but you can pull out the code that takes the username and password and verifies it.
This is arguably easier to setup, but at the cost to the user.

how can I use mitreId openid in a angular and java based project

I am fairly new to the openId connect, I want integrate MitreId OpenId connect server in my project that is based on angular and java (servlet), but I have no idea how to integrate.
I read the documentation of mitreId but unable to configure it.
Please help me with some example or link so that I can understand and able to implement.
Requirement When I try to login with app it go to the mitreid openid connect server and authenticate it and return back with token id, scope and role and according to that information app gives the response.
Thanks:

How to integrate google api Spreadsheet callback url on my production server

I am reading data from google spreadsheet API using java. I am able to read on my local machine and the URL getting below for auth2:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=679281701678-iacku5po12k0if70abstnthne9ia57kg.apps.googleusercontent.com&redirect_uri=http://localhost:39740/Callback&response_type=code&scope=https://www.googleapis.com/auth/spreadsheets
My callback URL is
http://localhost:62238/Callback?code=4/k6rwrqBFTJ310Yhy9EBpIA7eH9PqL-HXwC3hi9Q0How#
However, when I am deploying my war on the production server so I am not able to see callback function.
If any one knows about this please suggest to me how to integrate on the production server.
Whenever you integrate with any OAUTH enabled google api. You need to provide the restrictions on google dev console like authorized origins and authorized redirect uris. I think you might have provided different port from your local than what is running in your production in your authorized origins, that is why it is not able to connect from your production server but it is able to connect from your local. you can cross check once.

SSO Authentication/Active Directory/weblogic/apache proxy issues

I have been asked to implement seamless SSO authentication against active directory for a weblogic web based application.
After loads of testing and experimentation I have managed to get all the chain working as required.
Users logging in from a windows managed PC and using IE can seamlessly login to the web application.
After that, an apache was configured and installed between the web browser and weblogic in order to perform HTTPS-->HTTP termination. Once this was done the browser stopped performing seamless login - though basic authentication did work;
Investigating further, I noticed that the Authorization header was not forwarded across to weblogic which justifies why the authentication does not take place.
Note that the apache server I am using is 2.2.
Does anybody know if apache explicitly removes the Authorization header? I have also tried increasing the request maximum size to 30KB in case that was the problem
Thank you
We need to install the following package.
apt-get install libapache-mod-auth-kerb
First we have copy the HTTP.keytab (which is generated at "Active Directory") to etc/krb5.keytab like as below.
cp /root/HTTP.keytab /etc/krb5.keytab
Next we will have to give proper permissions.
chown www-data:www-data /etc/krb5.keytab
chmod 400 /etc/krb5.keytab
Next we go to Apache virtual hosts path
vi /etc/apache2/sites-available/default
Add one directory as like below
`<Directory />
AuthName "Kerberos Login"
AuthType Kerberos
Krb5Keytab /etc/krb5.keytab
KrbServiceName HTTP
KrbAuthRealm YOURDOMAIN.LOCAL //It is Domain name of your server
KrbMethodNegotiate on
KrbSaveCredentials on
KrbVerifyKDC on
Require valid-user
</Directory>`
Restart Apache web server
/etc/init.d/apache2 restart
Next go to browser of Active Directory client machine and hit the web server with FQDN of apache server. It will not ask you the password to open that website.
NOTE:
For explorer browser we need set automatic logon with user name and password at security tab
user authentication -> logon -> automatic logon with user name and password
If you found any difficulties please update me.

Categories