-
Notifications
You must be signed in to change notification settings - Fork 133
Spring Boot Centraldogma Loader #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flex-gyeongil
wants to merge
1
commit into
line:main
Choose a base branch
from
flex-gyeongil:spring-boot-loader
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 @@ | ||
| plugins { | ||
| alias libs.plugins.spring.boot | ||
| alias libs.plugins.kotlin.spring | ||
| alias libs.plugins.jib | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation libs.spring.boot3.starter.web | ||
| implementation libs.spring.boot3.starter.actuator | ||
| implementation libs.jackson.kotlin | ||
| implementation project(":server") | ||
| implementation project(":server-auth:saml") | ||
| implementation project(':server-mirror-git') | ||
|
|
||
| implementation(libs.armeria.saml) { | ||
| exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on' | ||
| } | ||
|
|
||
| implementation 'org.opensaml:opensaml-security-impl:3.4.6' | ||
| implementation 'org.opensaml:opensaml-saml-impl:3.4.6' | ||
|
|
||
| testImplementation libs.spring.boot3.starter.test | ||
|
|
||
| testImplementation("com.willowtreeapps.assertk:assertk:0.28.1") | ||
| } | ||
|
|
||
| jib { | ||
| from { | ||
| image = 'eclipse-temurin:21-jre-jammy' | ||
| } | ||
|
|
||
| container { | ||
| creationTime = 'USE_CURRENT_TIMESTAMP' | ||
| ports = ['8080', '36462'] | ||
| } | ||
| } |
This file contains hidden or 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,3 @@ | ||
| javaSourceCompatibility=17 | ||
| javaTargetCompatibility=17 | ||
| minimumJavaVersion=17 |
156 changes: 156 additions & 0 deletions
156
cloud-native/boot-loader/src/main/java/com/linecorp/armeria/server/saml/SamlEndpoint.java
This file contains hidden or 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,156 @@ | ||
| /* | ||
| * Copyright 2024 LINE Corporation | ||
| * | ||
| * LINE Corporation licenses this file to you 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: | ||
| * | ||
| * https://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 com.linecorp.armeria.server.saml; | ||
|
|
||
| import static com.google.common.base.MoreObjects.firstNonNull; | ||
| import static com.linecorp.armeria.server.saml.SamlPortConfig.validatePort; | ||
| import static java.util.Objects.requireNonNull; | ||
|
|
||
| import java.net.URI; | ||
| import java.net.URISyntaxException; | ||
|
|
||
| import org.springframework.web.util.UriComponentsBuilder; | ||
|
|
||
| import com.google.common.base.MoreObjects; | ||
|
|
||
| import com.linecorp.armeria.common.annotation.Nullable; | ||
| import com.linecorp.armeria.common.util.Exceptions; | ||
|
|
||
| /** | ||
| * A SAML service URL and its binding protocol. | ||
| */ | ||
| public final class SamlEndpoint { | ||
| /** | ||
| * Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP Redirect binding protocol. | ||
| */ | ||
| public static SamlEndpoint ofHttpRedirect(String uri) { | ||
| requireNonNull(uri, "uri"); | ||
| try { | ||
| return ofHttpRedirect(new URI(uri)); | ||
| } catch (URISyntaxException e) { | ||
| return Exceptions.throwUnsafely(e); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP Redirect binding protocol. | ||
| */ | ||
| public static SamlEndpoint ofHttpRedirect(URI uri) { | ||
| requireNonNull(uri, "uri"); | ||
| return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_REDIRECT); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP POST binding protocol. | ||
| */ | ||
| public static SamlEndpoint ofHttpPost(String uri) { | ||
| requireNonNull(uri, "uri"); | ||
| try { | ||
| return ofHttpPost(new URI(uri)); | ||
| } catch (URISyntaxException e) { | ||
| return Exceptions.throwUnsafely(e); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Creates a {@link SamlEndpoint} of the specified {@code uri} and the HTTP POST binding protocol. | ||
| */ | ||
| public static SamlEndpoint ofHttpPost(URI uri) { | ||
| requireNonNull(uri, "uri"); | ||
| return new SamlEndpoint(uri, SamlBindingProtocol.HTTP_POST); | ||
| } | ||
|
|
||
| private final URI uri; | ||
| private final SamlBindingProtocol bindingProtocol; | ||
| private final String uriAsString; | ||
|
|
||
| private SamlEndpoint(URI uri, SamlBindingProtocol bindingProtocol) { | ||
| this.uri = uri; | ||
| this.bindingProtocol = bindingProtocol; | ||
| uriAsString = uri.toString(); | ||
| } | ||
|
|
||
| /** | ||
| * Returns a {@link URI} of this endpoint. | ||
| */ | ||
| public URI uri() { | ||
| return uri; | ||
| } | ||
|
|
||
| /** | ||
| * Returns a {@link URI} of this endpoint as a string. | ||
| */ | ||
| public String toUriString() { | ||
| return uriAsString; | ||
| } | ||
|
|
||
| /** | ||
| * Returns a {@link URI} of this endpoint as a string. The omitted values in the {@link URI} will be | ||
| * replaced with the specified default values, such as {@code defaultScheme}, {@code defaultHostname} | ||
| * and {@code defaultPort}. | ||
| */ | ||
| String toUriString(String defaultScheme, String defaultHostname, int defaultPort) { | ||
| requireNonNull(defaultScheme, "defaultScheme"); | ||
| requireNonNull(defaultHostname, "defaultHostname"); | ||
| validatePort(defaultPort); | ||
|
|
||
| final String scheme = firstNonNull(uri.getScheme(), defaultScheme); | ||
| final UriComponentsBuilder builder = UriComponentsBuilder.newInstance() | ||
| .scheme(scheme) | ||
| .host(firstNonNull(uri.getHost(), defaultHostname)); | ||
|
|
||
| // FIXME Should be applied to armeria upstream!! | ||
| final int port = uri.getPort() > 0 ? uri.getPort() : defaultPort; | ||
| if (!(port == 80 && "http".equals(scheme) || port == 443 && "https".equals(scheme))) { | ||
| builder.port(uri.getPort() > 0 ? uri.getPort() : defaultPort); | ||
| } | ||
| return builder | ||
| .path(uri.getPath()) | ||
| .toUriString(); | ||
| } | ||
|
Comment on lines
+115
to
+123
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Temporal handling due to known port erasing.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops what's the bug btw? |
||
|
|
||
| /** | ||
| * Returns a {@link SamlBindingProtocol} of this endpoint. | ||
| */ | ||
| public SamlBindingProtocol bindingProtocol() { | ||
| return bindingProtocol; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(@Nullable Object o) { | ||
| if (this == o) { | ||
| return true; | ||
| } | ||
| if (!(o instanceof SamlEndpoint)) { | ||
| return false; | ||
| } | ||
| final SamlEndpoint that = (SamlEndpoint) o; | ||
| return uri().equals(that.uri()) && bindingProtocol() == that.bindingProtocol(); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return uri().hashCode() * 31 + bindingProtocol().hashCode(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return MoreObjects.toStringHelper(this) | ||
| .add("uri", uri) | ||
| .add("bindingProtocol", bindingProtocol) | ||
| .toString(); | ||
| } | ||
| } | ||
25 changes: 25 additions & 0 deletions
25
cloud-native/boot-loader/src/main/java/com/linecorp/armeria/server/saml/package-info.java
This file contains hidden or 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,25 @@ | ||
|
|
||
| /* | ||
| * Copyright 2018 LINE Corporation | ||
| * | ||
| * LINE Corporation licenses this file to you 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: | ||
| * | ||
| * https://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. | ||
| */ | ||
|
|
||
| /** | ||
| * <a href="https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language">SAML</a>-based single sign-on | ||
| * service. | ||
| */ | ||
| @NonNullByDefault | ||
| package com.linecorp.armeria.server.saml; | ||
|
|
||
| import com.linecorp.armeria.common.annotation.NonNullByDefault; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make separated concern for other configurations.
I had some dependency issues by this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure which problem you've gone through but make sure not to include the slf4j1 for spring boot3 module.