-
Notifications
You must be signed in to change notification settings - Fork 827
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Store client authentication method in JWT (#2385)
* Store client authentication method in JWT Why: UAA historical supported only secret based client authentication, so no need to have this information on client side. No there is a public usage, later private_key_jwt should be supported. Maybe then tls_client_auth. * refactor * tests * tests * extend tests for client_auth_method in refresh token * more tests * review
- Loading branch information
Showing
13 changed files
with
252 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
server/src/main/java/org/cloudfoundry/identity/uaa/util/UaaSecurityContextUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package org.cloudfoundry.identity.uaa.util; | ||
|
||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.core.context.SecurityContextHolder; | ||
import org.springframework.security.oauth2.provider.OAuth2Authentication; | ||
|
||
import java.io.Serializable; | ||
import java.util.Map; | ||
|
||
import static org.cloudfoundry.identity.uaa.oauth.token.ClaimConstants.CLIENT_AUTH_METHOD; | ||
|
||
public final class UaaSecurityContextUtils { | ||
|
||
private UaaSecurityContextUtils() {} | ||
|
||
public static String getClientAuthenticationMethod() { | ||
Authentication a = SecurityContextHolder.getContext().getAuthentication(); | ||
if (!(a instanceof OAuth2Authentication)) { | ||
return null; | ||
} | ||
OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) a; | ||
|
||
Map<String, Serializable> extensions = oAuth2Authentication.getOAuth2Request().getExtensions(); | ||
if (extensions.isEmpty()) { | ||
return null; | ||
} | ||
|
||
return (String) extensions.get(CLIENT_AUTH_METHOD); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.