Skip to content

Commit

Permalink
Merge branch 'develop' into enroll-mgmt-exception-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
harisboston authored Sep 10, 2020
2 parents fca126e + 53589cb commit 3ed6cd8
Show file tree
Hide file tree
Showing 52 changed files with 784 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
Expand All @@ -26,6 +27,9 @@
@ComponentScan(basePackages = "com.google.cloud.healthcare.fdamystudies")
public class CommonModuleConfiguration implements WebMvcConfigurer {

@Autowired
private RestTemplateAuthTokenModifierInterceptor restTemplateAuthTokenModifierInterceptor;

@Bean
public ObjectMapper objectMapper() {
return new ObjectMapper();
Expand Down Expand Up @@ -57,7 +61,7 @@ protected void addInterceptors(RestTemplate restTemplate) {
if (CollectionUtils.isEmpty(interceptors)) {
interceptors = new ArrayList<>();
}
interceptors.add(new RestTemplateAuthTokenModifierInterceptor());
interceptors.add(restTemplateAuthTokenModifierInterceptor);
restTemplate.setInterceptors(interceptors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Component;

@Component
public class RestTemplateAuthTokenModifierInterceptor implements ClientHttpRequestInterceptor {

@Autowired private OAuthService oauthService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "app_info")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class AppEntity implements Serializable {

private static final long serialVersionUID = 4985607753888575491L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,12 @@
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@ToString
@Setter
@Getter
@Entity
@Table(name = "app_permissions")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class AppPermissionEntity implements Serializable {

private static final long serialVersionUID = 8610289975376774137L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "audit_events")
@ConditionalOnProperty(
value = "commonservice.auditlogevent.enabled",
havingValue = "true",
matchIfMissing = true)
public class AuditEventEntity {

@Id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,11 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "auth_info")
@ConditionalOnProperty(
value = "participant.datastore.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class AuthInfoEntity implements Serializable {

private static final long serialVersionUID = 4985607753888575491L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,11 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "locations")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class LocationEntity implements Serializable {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
@Setter
@Getter
@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
@Setter
@Getter
@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@AllArgsConstructor
@Builder
Expand All @@ -36,10 +35,6 @@
@Entity
@NoArgsConstructor
@Table(name = "personalized_user_report")
@ConditionalOnProperty(
value = "participant.datastore.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class PersonalizedUserReportEntity implements Serializable {

private static final long serialVersionUID = -3019529323339411129L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,11 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "sites")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class SiteEntity implements Serializable {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "sites_permissions")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class SitePermissionEntity implements Serializable {

private static final long serialVersionUID = 1L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,11 @@
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "study_consent")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class StudyConsentEntity implements Serializable {

private static final long serialVersionUID = 6218229749598633153L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
Expand All @@ -49,10 +48,6 @@
columnNames = {"custom_id", "app_info_id"},
name = "study_info_custom_id_app_info_id_uidx")
})
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class StudyEntity implements Serializable {

private static final long serialVersionUID = 5392367043067145963L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,12 @@
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@ToString
@Entity
@Table(name = "study_permissions")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class StudyPermissionEntity implements Serializable {

private static final long serialVersionUID = -9223143734827095684L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
@Entity
@Table(name = "user_app_details")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class UserAppDetailsEntity implements Serializable {

private static final long serialVersionUID = 4985607753888575491L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
@Setter
@Getter
@ToString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

@Setter
@Getter
Expand All @@ -28,10 +27,6 @@
@Builder
@NoArgsConstructor
@Table(name = "user_institution")
@ConditionalOnProperty(
value = "participant.datastore.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class UserInstitutionEntity {
@Id
@GeneratedValue(generator = "system-uuid")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@
import lombok.ToString;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.data.annotation.Transient;

@ToString
@Getter
@Setter
@Entity
@Table(name = "ur_admin_user")
@ConditionalOnProperty(
value = "participant.manager.entities.enabled",
havingValue = "true",
matchIfMissing = false)
public class UserRegAdminEntity implements Serializable {

private static final long serialVersionUID = 8686769972691178223L;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"code": 200,
"message":"SUCCESS",
"isValidClient":true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"error": "request_unauthorized",
"error_description": "The request could not be authorized",
"error_hint": "Check that you provided valid credentials in the right format.",
"status_code": 401,
"error_debug": ": not_found",
"request_id": ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "POST",
"url": "/AuthServer/tokenAuthentication"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"bodyFileName": "auth-server/auth-server-token-validation-response.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "POST",
"url": "/AuthServer/validateClientCredentials"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"bodyFileName": "auth-server/validate_client_credential_response.json"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"request": {
"method": "GET",
"url": "/restTemplateAuthTokenModifierInterceptor",
"headers": {
"Authorization": {
"contains": "cd57710c-1d19-4058-8bfe-a6aac3a39e35"
}
}
},
"response": {
"status": 401,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"bodyFileName": "oauth-scim-service/unauthorized.json"
}
}
Loading

0 comments on commit 3ed6cd8

Please sign in to comment.