-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate AADAppRoleStatelessAuthenticationFilter and AADAuthenticationFilter #17926
Changes from 3 commits
1ce3337
5b2f8a2
cf90817
00e26a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,22 @@ | |
|
||
package com.azure.spring.autoconfigure.aad; | ||
|
||
import static com.azure.spring.autoconfigure.aad.Constants.DEFAULT_AUTHORITY_SET; | ||
import static com.azure.spring.autoconfigure.aad.Constants.ROLE_PREFIX; | ||
import com.nimbusds.jose.JOSEException; | ||
import com.nimbusds.jose.proc.BadJOSEException; | ||
import com.nimbusds.jwt.proc.BadJWTException; | ||
import java.io.IOException; | ||
import java.text.ParseException; | ||
import java.util.Collection; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpHeaders; | ||
|
@@ -18,26 +31,18 @@ | |
import org.springframework.util.StringUtils; | ||
import org.springframework.web.filter.OncePerRequestFilter; | ||
|
||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
import java.text.ParseException; | ||
import java.util.Collection; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import static com.azure.spring.autoconfigure.aad.Constants.DEFAULT_AUTHORITY_SET; | ||
import static com.azure.spring.autoconfigure.aad.Constants.ROLE_PREFIX; | ||
|
||
/** | ||
* A stateless authentication filter which uses app roles feature of Azure Active Directory. Since it's a stateless | ||
* implementation so the principal will not be stored in session. By using roles claim in the token it will not call | ||
* Microsoft Graph to retrieve users' groups. | ||
* <p> | ||
* | ||
* @deprecated For AADAppRoleStatelessAuthenticationFilter, suggest use spring-security resource-server directly and | ||
* include azure-spring-boot-starter-active-directory dependencies into your project.Automatic configuration of the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add space before Automatic |
||
* associated AAD will be started, they will work well together. | ||
* See the <a href="https://github.com/Azure/azure-sdk-for-java/issues/17860">Alternative method</a>. | ||
*/ | ||
@Deprecated | ||
public class AADAppRoleStatelessAuthenticationFilter extends OncePerRequestFilter { | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(AADAppRoleStatelessAuthenticationFilter.class); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,23 @@ | |
|
||
package com.azure.spring.autoconfigure.aad; | ||
|
||
import static com.azure.spring.autoconfigure.aad.Constants.BEARER_PREFIX; | ||
import com.microsoft.aad.msal4j.MsalServiceException; | ||
import com.nimbusds.jose.JOSEException; | ||
import com.nimbusds.jose.jwk.source.JWKSetCache; | ||
import com.nimbusds.jose.proc.BadJOSEException; | ||
import com.nimbusds.jose.util.ResourceRetriever; | ||
import com.nimbusds.jwt.proc.BadJWTException; | ||
import java.io.IOException; | ||
import java.net.MalformedURLException; | ||
import java.text.ParseException; | ||
import java.util.Optional; | ||
import javax.naming.ServiceUnavailableException; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpSession; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpHeaders; | ||
|
@@ -19,24 +30,17 @@ | |
import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; | ||
import org.springframework.web.filter.OncePerRequestFilter; | ||
|
||
import javax.naming.ServiceUnavailableException; | ||
import javax.servlet.FilterChain; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import javax.servlet.http.HttpSession; | ||
import java.io.IOException; | ||
import java.net.MalformedURLException; | ||
import java.text.ParseException; | ||
import java.util.Optional; | ||
|
||
import static com.azure.spring.autoconfigure.aad.Constants.BEARER_PREFIX; | ||
|
||
Comment on lines
-22
to
-34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really need change this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi, @backwind1233 , It's OK to keep the diff in the PR. The style is same to other java files in |
||
/** | ||
* A stateful authentication filter which uses Microsoft Graph groups to authorize. Both ID token and access token are | ||
* supported. In the case of access token, only access token issued for the exact same application this filter used for | ||
* could be accepted, e.g. access token issued for Microsoft Graph could not be processed by users' application. | ||
* <p> | ||
* | ||
* @deprecated For AADAuthenticationFilter,in normal case, resource-server not support session. So | ||
* AADAuthenticationFilter will not supported in the future. See the | ||
* <a href="https://github.com/Azure/azure-sdk-for-java/issues/17860">Alternative method</a>. | ||
*/ | ||
@Deprecated | ||
public class AADAuthenticationFilter extends OncePerRequestFilter { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(AADAuthenticationFilter.class); | ||
private static final String CURRENT_USER_PRINCIPAL = "CURRENT_USER_PRINCIPAL"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do this,change format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It changes due to the automatic import of IDEA.