Skip to content

Commit

Permalink
Fix config and expected.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 committed Jan 28, 2025
1 parent 8f91e3b commit 73b7038
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,9 @@ appConfig:
additionalGroupSuffix: " (sandbox)"
createAsSubjectId: "Administrators"
createAsType: "GROUP"
destinationPath: "/Feeds"
destinationExplorerPath: "/Feeds"
enabled: false
templatesPath: "/Feeds/Content Templates"
templatesExplorerPath: "/Feeds/Content Templates"
dataFeedKeysDir: "data_feed_keys"
enabledAuthenticationTypes:
- "CERTIFICATE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ proxyConfig:
additionalGroupSuffix: " (sandbox)"
createAsSubjectId: "Administrators"
createAsType: "GROUP"
destinationPath: "/Feeds"
destinationExplorerPath: "/Feeds"
enabled: false
templatesPath: "/Feeds/Content Templates"
templatesExplorerPath: "/Feeds/Content Templates"
dataFeedKeysDir: "data_feed_keys"
enabledAuthenticationTypes:
- "CERTIFICATE"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AutoContentCreationConfig
private final String destinationExplorerPath;

@JsonProperty
private final String templatesPath;
private final String templatesExplorerPath;

@JsonProperty
private final String additionalGroupSuffix;
Expand All @@ -47,7 +47,7 @@ public AutoContentCreationConfig() {
enabled = false;
destinationExplorerPath = DocPath.fromParts(DEFAULT_DESTINATION_PATH_PART)
.toString();
templatesPath = DocPath.fromParts(DEFAULT_DESTINATION_PATH_PART, DEFAULT_TEMPLATES_PATH_PART)
templatesExplorerPath = DocPath.fromParts(DEFAULT_DESTINATION_PATH_PART, DEFAULT_TEMPLATES_PATH_PART)
.toString();
additionalGroupSuffix = " (sandbox)";
createAsSubjectId = User.ADMINISTRATORS_GROUP_SUBJECT_ID;
Expand All @@ -57,13 +57,13 @@ public AutoContentCreationConfig() {
@JsonCreator
public AutoContentCreationConfig(@JsonProperty("enabled") final boolean enabled,
@JsonProperty("destinationExplorerPath") final String destinationExplorerPath,
@JsonProperty("templatesPath") final String templatesPath,
@JsonProperty("templatesExplorerPath") final String templatesExplorerPath,
@JsonProperty("additionalGroupSuffix") final String additionalGroupSuffix,
@JsonProperty("createAsSubjectId") final String createAsSubjectId,
@JsonProperty("createAsType") final UserType createAsType) {
this.enabled = enabled;
this.destinationExplorerPath = destinationExplorerPath;
this.templatesPath = templatesPath;
this.templatesExplorerPath = templatesExplorerPath;
this.additionalGroupSuffix = additionalGroupSuffix;
this.createAsSubjectId = createAsSubjectId;
this.createAsType = createAsType;
Expand All @@ -72,7 +72,7 @@ public AutoContentCreationConfig(@JsonProperty("enabled") final boolean enabled,
private AutoContentCreationConfig(Builder builder) {
this.enabled = builder.enabled;
this.destinationExplorerPath = builder.destinationPath;
this.templatesPath = builder.templatesPath;
this.templatesExplorerPath = builder.templatesPath;
this.additionalGroupSuffix = builder.additionalGroupSuffix;
this.createAsSubjectId = builder.createAsSubjectId;
this.createAsType = builder.createAsType;
Expand All @@ -99,8 +99,8 @@ public String getDestinationExplorerPath() {
@JsonPropertyDescription(
"The path to a folder in the Stroom explorer tree where Stroom will look for content " +
"to use as a template for auto-creating content.")
public String getTemplatesPath() {
return templatesPath;
public String getTemplatesExplorerPath() {
return templatesExplorerPath;
}

@JsonPropertyDescription(
Expand Down Expand Up @@ -145,7 +145,7 @@ public Builder copy() {
return new Builder()
.enabled(enabled)
.destinationPath(destinationExplorerPath)
.templatesPath(templatesPath);
.templatesPath(templatesExplorerPath);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ public Optional<UserIdentity> authenticate(final HttpServletRequest request,
// Entries from the data feed key trump what is in the headers
attributeMap.putAll(streamMeta);

// Verify that the accountId provided in the headers corresponds to the data
// feed key sent. Stops them using their own DFK to authenticate to someone
// else's accountId.
final String accountId = NullSafe.trim(attributeMap.get(StandardHeaderArguments.ACCOUNT_ID));
if (!Objects.equals(dataFeedKey.getAccountId(), accountId)) {
throw new StroomStreamException(StroomStatusCode.INVALID_ACCOUNT_ID, attributeMap);
Expand Down

0 comments on commit 73b7038

Please sign in to comment.