Spring OAuth2: XML -> Java configuration - java

i am just migrating a spring 3 application from xml-configuration to java config.
We are using spring 3.2.8 + spring security 3.2.4.
I am wondering how to move the following XML config to java.
<oauth:client id="oauth2ClientFilter" />
Any idea?

Ok, so it seems (if you are not using spring boot) right now there is no direct possibility of doing a full java-configuration for SSO/OAuth2.
I got around it by using #import to load my old XML-based configuration-
#Configuration
#EnableWebSecurity
#ImportResource({"classpath*:spring-security-RSA.xml"})
public class SecurityRSAStrategyConfiguration {
...
}

I have exactly the opposite problem, I have a spring (not boot) application and need to authenticate to an external oauth2 IDP (in this case Azure AD), just using spring-security 3.2.1, spring fwork 4.3.18. Finding directions without spring boot is a challenge!

Related

Spring Security SAML ADFS on NON Spring project

I have a web application NOT implemented on Spring Boot or Spring itself. It has no Spring whatsoever, it was made using RESTEasy running on Tomcat.
I'm supposed to add ADFS authentication to this web application through the use of Spring's Security SAML Extension.
I've seen a lot of projects online that implement this feature but all of them use Spring Boot or run on Spring. At the same time I've seen mentions of being able to implement Spring SAML without having a Spring project. So I'm a little confused now.
Is this feat achievable?
If so, could you guide me on how to do it?
Which Maven dependencies do I need exactly?
Which web.xml configs do I need?
Which Beans do I need to implement?
Thank you in advance.

Spring Boot Security CAS Authentication Integration

I am in desperate need of help. So as a prerequisite I am tasked with creating a simple web application. The application requirements are to create a simple web form that collects user data and then sends an email verification to the user that just provided information. The difficult aspect of this project is CAS Integration with the Marist College CAS authentication system. A requirement of this project was that I use Spring Boot to create the project. At the moment I have already implemented Spring Security to authenticate users. I have been trying everything online to integrate CAS with my existing project. I was hoping that someone on StackOverflow may have more knowledge on how to integrate CAS with SpringSecurtiy. Also please don't be harsh on me I have never used the spring framework before this project and this is all new to me. The Url of the CAS server is "https://login.marist.edu/cas/". I have looked into https://github.com/apereo/java-cas-client spring support I just don't know how to integrate it with my current application. Thank you to anyone in advance that lends me a hand with this.
As I previously stated I would provide the solution to the problem that I experienced during the processes of integrating a spring application with the Marist CAS 2.0 Authentication System. As Stated above there is a Spring Boot AutoConfiguration that can be used. While this may not be the best method for securing your application it satisfied my needs for the project that I was working on. The Steps to configure your spring application with CAS 2.0 are bellow.
Add Maven Dependency
Maven:
<dependency>
<groupId>org.jasig.cas.client</groupId>
<artifactId>cas-client-support-springboot</artifactId>
<version>${java.cas.client.version}</version>
</dependency>
Add the following required properties in Spring Boot's application.properties or application.yml
cas.server-url-prefix=https://cashost.com/cas
cas.server-login-url=https://cashost.com/cas/login
cas.client-host-url=https://casclient.com
3)Annotate Spring Boot application (or any #Configuration class) with #EnableCasClient annotation
#SpringBootApplication
#Controller
#EnableCasClient
public class MyApplication { .. }
4)For CAS3 protocol (authentication and validation filters) - which is default if nothing is specified
cas.validation-type=CAS3
For CAS2 protocol (authentication and validation filters)
cas.validation-type=CAS
For SAML protocol (authentication and validation filters)
cas.validation-type=SAML

How to disable login in Spring Boot Netflix' eureka?

I'm setting up a microservice architecture using Spring Boot and Eureka. I followed several tutorials. However, the Eureka server is showing a login when trying to open the dashboard. Also, registration of a client fails (I think because of the enabled security).
How can I disable the security?
This is my configuration:
eureka.instance.hostname=localhost
eureka.client.registerWithEureka=false
eureka.client.fetchRegistry=false
eureka.environment=dev
server.port=1112
I'm using a .properties file instead of .yml. What I tried is to add the property
security.basic.enabled=false
but the result was the same. So I tried to configure Spring Boot Security by myself but this caused 404 HTTP errors because the '/login'-controller was not found (and I don't want to develop this at the moment).
You have added two starter security dependencies in your Gradle. Those are configuring basic username password security. Please remove them.
you can also exclude the SecurityAutoConfiguration in your spring application main class
#SpringBootApplication(exclude = {SecurityAutoConfiguration.class})

How to set responseSkew property value in WebSSOProfileConsumerImpl in Spring boot

I am trying to integrate SAML OKTA in a spring boot application. I need to use the the following bean setup in spring boot:
Can any one please help me setting the responseSkew property in webSSOprofileConsumer bean in Spring boot.I just need an equivalent spring injection technique of the xml configuration that I mentioned above in annotation based spring boot injection.
I have already gone through the link :
http://docs.spring.io/spring-security-saml/docs/current/reference/html/configuration-advanced.html
There it is mentioned about setting responseSkew but it is not mentioned how to do it in java based annotated configuration in a spring boot application.
Thanks in advance.
If you're using a child class of AbstractProfileBase (e.g. WebSSOProfileConsumerImpl) you simply can use its setter:
setResponseSkew(int responseSkew)
For xml configuration of spring boot I dunno how to achieve this because I never got used to it.

Migrating from Spring security 2.0 to Spring security 3.0.7

I am having a project which uses Spring framework(migrated from 2.0 to 3.0.7) and Spring security 2.0. And I want to use Spring security 3.0.7. I have used MessageDigestPasswordEncoder, SecurityContextHolder. But now I've added Spring security 3.0.7 jar files to my project but it is showing some compilation issues to above classes.
I need help for migration.
Thanks in advance.

Categories

Resources