PreAuthentication with Spring Security -> Based on URL parameters

后端 未结 2 1826
轮回少年
轮回少年 2020-12-05 01:07

The customer want to have the following scenario:

Customer hands out link (webapp address) with 2 parameters to the webapp user. Based on these variables the user wi

2条回答
  •  無奈伤痛
    2020-12-05 01:54

    The way I have resolved this with similar situations is to to use a servlet filter to grab the parameters. I would recommend extending the org.springframework.web.filter.GenericFilterBean.

    From these parameters, create an auth object of some sort (such as a token), that can be passed into the AuthenticationManager which you can autowire in (or get in some other method).

    You will then need to have an AuthenticationProvider that can handle your auth object and generate a UserDetails object with the GrantedAuthority collection you need to satisfy the specific roles you want the user to have.

提交回复
热议问题