-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the Springdog agent path prefix to be applied at runtime
- Loading branch information
Showing
12 changed files
with
163 additions
and
236 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...og-agent/src/main/java/org/easypeelsecurity/springdog/agent/SpringdogAgentController.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,27 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.easypeelsecurity.springdog.agent; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
|
||
/** | ||
* Annotation for Springdog agent controller. | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface SpringdogAgentController { | ||
} |
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
69 changes: 69 additions & 0 deletions
69
.../src/main/java/org/easypeelsecurity/springdog/agent/SpringdogDynamicUrlMappingConfig.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,69 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.easypeelsecurity.springdog.agent; | ||
|
||
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.method.HandlerTypePredicate; | ||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; | ||
|
||
import org.easypeelsecurity.springdog.shared.configuration.SpringdogProperties; | ||
import org.easypeelsecurity.springdog.shared.util.Assert; | ||
|
||
/** | ||
* Springdog dynamic URL mapping configuration. | ||
* Enable agent access to the springdog path user determine at runtime. | ||
*/ | ||
@Component | ||
public class SpringdogDynamicUrlMappingConfig implements WebMvcRegistrations { | ||
|
||
private final SpringdogProperties springdogProperties; | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public SpringdogDynamicUrlMappingConfig(SpringdogProperties springdogProperties) { | ||
this.springdogProperties = springdogProperties; | ||
} | ||
|
||
@Override | ||
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { | ||
return new CustomRequestMappingHandlerMapping(springdogProperties); | ||
} | ||
|
||
private static class CustomRequestMappingHandlerMapping extends RequestMappingHandlerMapping { | ||
private final SpringdogProperties springdogProperties; | ||
|
||
CustomRequestMappingHandlerMapping(SpringdogProperties springdogProperties) { | ||
this.springdogProperties = springdogProperties; | ||
} | ||
|
||
@Override | ||
protected void initHandlerMethods() { | ||
String basePath = springdogProperties.computeAbsolutePath(""); | ||
Assert.notNull(basePath, "Springdog Agent's base path must not be null"); | ||
|
||
setPathPrefixes( | ||
java.util.Collections.singletonMap( | ||
basePath, | ||
HandlerTypePredicate.forAnnotation(SpringdogAgentController.class) | ||
) | ||
); | ||
super.initHandlerMethods(); | ||
} | ||
} | ||
} |
162 changes: 0 additions & 162 deletions
162
...onfigure/src/main/java/org/easypeelsecurity/springdog/autoconfigure/PropertiesLoader.java
This file was deleted.
Oops, something went wrong.
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
42 changes: 0 additions & 42 deletions
42
...a/org/easypeelsecurity/springdog/autoconfigure/applier/SpringdogAgentSecurityApplier.java
This file was deleted.
Oops, something went wrong.
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.