-
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.
- Loading branch information
Showing
10 changed files
with
177 additions
and
27 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
server/src/main/java/org/cloudfoundry/identity/uaa/client/UaaClientDetails.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 |
---|---|---|
@@ -1,23 +1,76 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import org.springframework.security.core.SpringSecurityCoreVersion; | ||
import org.springframework.security.oauth2.provider.ClientDetails; | ||
import org.springframework.security.oauth2.provider.client.BaseClientDetails; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Objects; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
|
||
@JsonInclude(JsonInclude.Include.NON_DEFAULT) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class UaaClientDetails extends BaseClientDetails { | ||
|
||
private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; | ||
|
||
@JsonProperty("client_jwt_config") | ||
private String clientJwtConfig; | ||
|
||
public UaaClientDetails() { | ||
} | ||
|
||
UaaClientDetails(ClientDetails prototype) { | ||
super(prototype); | ||
this.setAdditionalInformation(prototype.getAdditionalInformation()); | ||
} | ||
|
||
public UaaClientDetails(String clientId, String resourceIds, | ||
String scopes, String grantTypes, String authorities, String redirectUris) { | ||
super(clientId, resourceIds, scopes, grantTypes, authorities, redirectUris); | ||
} | ||
|
||
@Override | ||
public void setScope(Collection<String> scope) { | ||
Set<String> sanitized = scope.stream() | ||
.flatMap(s -> Arrays.stream(s.split(","))) | ||
.collect(Collectors.toSet()); | ||
super.setScope(sanitized); | ||
} | ||
|
||
public String getClientJwtConfig() { | ||
return clientJwtConfig; | ||
} | ||
|
||
public void setClientJwtConfig(String clientJwtConfig) { | ||
this.clientJwtConfig = clientJwtConfig; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
if (o instanceof UaaClientDetails) { | ||
UaaClientDetails uaaClientDetails = (UaaClientDetails) o; | ||
return Objects.equals(clientJwtConfig, uaaClientDetails.clientJwtConfig); | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = super.hashCode(); | ||
|
||
result = 31 * result + (clientJwtConfig != null ? clientJwtConfig.hashCode() : 0); | ||
return result; | ||
} | ||
} |
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
1 change: 1 addition & 0 deletions
1
...oudfoundry/identity/uaa/db/hsqldb/V4_104__Add_ClientJwtConfig_To_Oauth_Client_Details.sql
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 @@ | ||
ALTER TABLE oauth_client_details ADD COLUMN client_jwt_config CLOB DEFAULT NULL; |
1 change: 1 addition & 0 deletions
1
...loudfoundry/identity/uaa/db/mysql/V4_104__Add_ClientJwtConfig_To_Oauth_Client_Details.sql
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 @@ | ||
ALTER TABLE oauth_client_details ADD COLUMN client_jwt_config TEXT DEFAULT NULL; |
1 change: 1 addition & 0 deletions
1
...oundry/identity/uaa/db/postgresql/V4_104__Add_ClientJwtConfig_To_Oauth_Client_Details.sql
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 @@ | ||
ALTER TABLE oauth_client_details ADD COLUMN client_jwt_config TEXT DEFAULT NULL; |
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.