-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Database changes for new client metadata assets
- Added new table definitions for all databases - Added database access API and implementation [#109263482] https://www.pivotaltracker.com/story/show/109263482 Signed-off-by: Jonathan Lo <jlo@us.ibm.com>
- Loading branch information
1 parent
92579ad
commit ec2bd14
Showing
12 changed files
with
822 additions
and
0 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
model/src/main/java/org/cloudfoundry/identity/uaa/client/ClientMetadata.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,83 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import java.net.URL; | ||
|
||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | ||
* <p> | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* <p> | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class ClientMetadata { | ||
|
||
private String clientId; | ||
private String identityZoneId; | ||
private boolean showOnHomePage; | ||
private URL appLaunchUrl; | ||
private String appIcon; | ||
private int version; | ||
|
||
@JsonIgnore | ||
public String getClientId() { | ||
return clientId; | ||
} | ||
|
||
@JsonIgnore | ||
public void setClientId(String clientId) { | ||
this.clientId = clientId; | ||
} | ||
|
||
@JsonIgnore | ||
public String getIdentityZoneId() { | ||
return identityZoneId; | ||
} | ||
|
||
@JsonIgnore | ||
public void setIdentityZoneId(String identityZoneId) { | ||
this.identityZoneId = identityZoneId; | ||
} | ||
|
||
public boolean isShowOnHomePage() { | ||
return showOnHomePage; | ||
} | ||
|
||
public void setShowOnHomePage(boolean showOnHomePage) { | ||
this.showOnHomePage = showOnHomePage; | ||
} | ||
|
||
public URL getAppLaunchUrl() { | ||
return appLaunchUrl; | ||
} | ||
|
||
public void setAppLaunchUrl(URL appLaunchUrl) { | ||
this.appLaunchUrl = appLaunchUrl; | ||
} | ||
|
||
public String getAppIcon() { | ||
return appIcon; | ||
} | ||
|
||
public void setAppIcon(String appIcon) { | ||
this.appIcon = appIcon; | ||
} | ||
|
||
@JsonIgnore | ||
public int getVersion() { | ||
return version; | ||
} | ||
|
||
@JsonIgnore | ||
public void setVersion(int version) { | ||
this.version = version; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
server/src/main/java/org/cloudfoundry/identity/uaa/client/ClientMetadataAdminEndpoints.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,67 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.security.oauth2.provider.ClientDetailsService; | ||
import org.springframework.security.oauth2.provider.NoSuchClientException; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | ||
* <p> | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* <p> | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
@Controller | ||
public class ClientMetadataAdminEndpoints { | ||
|
||
private ClientMetaDetailsProvisioning clientMetaDetailsProvisioning; | ||
private ClientDetailsService clients; | ||
|
||
@RequestMapping(value = "/oauth/clients/{client}/meta", method = RequestMethod.POST) | ||
@ResponseStatus(HttpStatus.CREATED) | ||
public ClientMetaDetails createClientUIDetails(@RequestBody ClientMetaDetails clientMetaDetails, | ||
@PathVariable("client") String clientId) | ||
throws ClientNotFoundException { | ||
|
||
try { | ||
clients.loadClientByClientId(clientId); | ||
} catch (NoSuchClientException nsce) { | ||
throw new ClientNotFoundException(clientId); | ||
} | ||
|
||
clientMetaDetails.setClientId(clientId); | ||
return clientMetaDetailsProvisioning.create(clientMetaDetails); | ||
} | ||
|
||
// GET | ||
@RequestMapping(value = "/oauth/clients/{client}/meta", method = RequestMethod.GET) | ||
@ResponseStatus(HttpStatus.OK) | ||
public ClientMetaDetails retrieveClientUIDetails(@PathVariable("client") String clientId) { | ||
return null; | ||
} | ||
|
||
// PUT (Update) | ||
|
||
// DELETE | ||
|
||
// GET (retrieveAll) | ||
|
||
public void setClientMetaDetailsProvisioning(ClientMetaDetailsProvisioning clientMetaDetailsProvisioning) { | ||
this.clientMetaDetailsProvisioning = clientMetaDetailsProvisioning; | ||
} | ||
|
||
public void setClients(ClientDetailsService clients) { | ||
this.clients = clients; | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
server/src/main/java/org/cloudfoundry/identity/uaa/client/ClientMetadataException.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,51 @@ | ||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2014] Pivotal Software, Inc. All Rights Reserved. | ||
* | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author Luke Taylor | ||
* @author Dave Syer | ||
*/ | ||
public class ClientMetadataException extends RuntimeException { | ||
|
||
private final HttpStatus status; | ||
protected Map<String, Object> extraInfo; | ||
|
||
public ClientMetadataException(String message, Throwable cause, HttpStatus status) { | ||
super(message, cause); | ||
this.status = status; | ||
} | ||
|
||
public ClientMetadataException(String message, HttpStatus status) { | ||
super(message); | ||
this.status = status; | ||
} | ||
|
||
public ClientMetadataException(String message, HttpStatus status, Map<String,Object> extraInformation) { | ||
super(message); | ||
this.status = status; | ||
this.extraInfo = extraInformation; | ||
} | ||
|
||
public HttpStatus getStatus() { | ||
return status; | ||
} | ||
|
||
public Map<String, Object> getExtraInfo() { | ||
return extraInfo; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...r/src/main/java/org/cloudfoundry/identity/uaa/client/ClientMetadataNotFoundException.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,36 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import org.cloudfoundry.identity.uaa.error.UaaException; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
|
||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | ||
* <p> | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* <p> | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Client not found") | ||
public class ClientMetadataNotFoundException extends UaaException { | ||
|
||
// private String clientId; | ||
|
||
// public ClientNotFoundException(String clientId) { | ||
// this.clientId = clientId; | ||
// } | ||
|
||
public ClientMetadataNotFoundException(String msg) { | ||
super("client_not_found", msg, HttpStatus.NOT_FOUND.value()); | ||
} | ||
|
||
|
||
// public String getClientId() { | ||
// return this.clientId; | ||
// } | ||
} |
18 changes: 18 additions & 0 deletions
18
server/src/main/java/org/cloudfoundry/identity/uaa/client/ClientMetadataProvisioning.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,18 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
import org.cloudfoundry.identity.uaa.resources.ResourceManager; | ||
|
||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | ||
* <p> | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* <p> | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
public interface ClientMetadataProvisioning extends ResourceManager<ClientMetaDetails> { | ||
} |
16 changes: 16 additions & 0 deletions
16
server/src/main/java/org/cloudfoundry/identity/uaa/client/ClientNotFoundException.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,16 @@ | ||
package org.cloudfoundry.identity.uaa.client; | ||
|
||
/******************************************************************************* | ||
* Cloud Foundry | ||
* Copyright (c) [2009-2015] Pivotal Software, Inc. All Rights Reserved. | ||
* <p> | ||
* This product is licensed to you under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this product except in compliance with the License. | ||
* <p> | ||
* This product includes a number of subcomponents with | ||
* separate copyright notices and license terms. Your use of these | ||
* subcomponents is subject to the terms and conditions of the | ||
* subcomponent's license, as noted in the LICENSE file. | ||
*******************************************************************************/ | ||
public class ClientNotFoundException { | ||
} |
Oops, something went wrong.