spring-security

Authenticate API Requests in Spring using Firebase Auth

梦想与她 提交于 2021-02-20 04:37:52
问题 Im already authenticating access to my API using a Firebase Auth token (JWT) which is passed inside the Http Authorization Header as Bearer token. This works fine using auto configuration. Now I want to map from the authentication to a user record in my DB. How do I need to adapt the security filter chain? This configuration is automatically applied by spring boot according to the docs and can be overridden: @Override protected void configure(HttpSecurity http) throws Exception { http

How to perform my own authentication (checking username and password typed by the user)

别来无恙 提交于 2021-02-20 04:35:05
问题 I implemented the UserDetailsService interface and override the loadUserByUsername method. I thought that, inside loadUserByUsername , I could get username and password, to check if they match username and password on the DB. But I can't understand how to get the password typed by the user, provided that it is possibile. Probably, I'm implementing the wrong interface. Is UserDetailsService enough to do what I want to or I have to implement or extend something else? 回答1: The UserDetailsService

Spring Security custom RememberMeAuthenticationFilter not getting fired

ぃ、小莉子 提交于 2021-02-20 04:18:50
问题 I have implemented 'Remember Me' functionality in my Spring MVC application using Spring Security 3.1 My security-context.xml looks like this : <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:security="http://www.springframework.org/schema/security" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www

How to perform a basic Spring Boot application security [closed]

依然范特西╮ 提交于 2021-02-20 04:12:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago . Improve this question I'm looking forward to deploying my Spring Application on a production environment and i'd like to include some basic and solid security measures. First things first, i extended WebSecurityConfigurerAdapter into my SecurityConfiguration.java

How to perform a basic Spring Boot application security [closed]

自闭症网瘾萝莉.ら 提交于 2021-02-20 04:11:08
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 9 months ago . Improve this question I'm looking forward to deploying my Spring Application on a production environment and i'd like to include some basic and solid security measures. First things first, i extended WebSecurityConfigurerAdapter into my SecurityConfiguration.java

Incremental authorization for Google OAuth2 Sign in with Spring Security

断了今生、忘了曾经 提交于 2021-02-19 08:47:05
问题 I was wondering if there is a way for authorizing incrementally with Spring Security (as mentioned here) By default spring security provides basic profile access when using Google sign OAuth verification. That flow is correct. I would however want to request for additional scopes (Gmail Read, Calendar read etc) on certain URL endpoints. I have already tried using the @PreAuthorize property on the endpoint along with enabling @EnableGlobalMethodSecurity(prePostEnabled = true) as in the code.

Spring MongoDB mapping OAuth2Authentication

泪湿孤枕 提交于 2021-02-19 08:01:20
问题 I'm writing my own implementation of TokenStore (org.springframework.security.oauth2.provider.token.TokenStore) using MongoDB. There seems to be some problem with converting/mapping of the object in the database back to Java object. Anyone have a clue how I could solve this? org.springframework.data.mapping.model.MappingInstantiationException: Failed to instantiate org.springframework.security.authentication.UsernamePasswordAuthenticationToken using constructor NO_CONSTRUCTOR with arguments

Multiple Spring Security filters

旧街凉风 提交于 2021-02-19 07:32:12
问题 I have 2 Spring Security WebSecurityConfigurerAdapter configs. I want to filter all requests to path /filter1 with filter 1, excluding /filter1/filter2 path. The latter one I want to filter with filter 2. How can I achieve it? Filter 1 config: @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers("filter1/filter2/**").permitAll() .and(

SAML authenticated users don't appear in Spring Security's SessionRegistry

纵饮孤独 提交于 2021-02-19 04:57:12
问题 Our application used to have only one possibility to log in: username and password. Once a new user logged into the application, their session would appear in Spring Security's SessionRegistry . Now I'm implementing SAML support with the help of Spring SAML. I oriented the setup heavily towards the sample application's configuration. It all works fine. However I noticed that users that log in via SAML don't get their session added to the SessionRegistry . The usual context file for form based

How to make spring security to call the requested resource after a successful authentication?

混江龙づ霸主 提交于 2021-02-19 03:46:52
问题 The title might be a bit misleading and might give you the impression this is an easy one so I will elaborate. I have a set of endpoints (REST services) that I want to secure without using the regular login way that Spring security provides. Usually you would first aim to the login endpoint (j_pring_security_check by default), authenticate and then send the request to the service endpoint along with the JSESSIONID. In this case i want to work without redirections. From the client-side I want