forked from spring-projects/spring-boot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Polish "Support authentication to private Docker registry"
- Loading branch information
1 parent
e8f555e
commit 86fa814
Showing
40 changed files
with
1,192 additions
and
746 deletions.
There are no files selected for viewing
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
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
41 changes: 41 additions & 0 deletions
41
...gframework/boot/buildpack/platform/docker/configuration/DockerRegistryAuthentication.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,41 @@ | ||
/* | ||
* Copyright 2012-2020 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 | ||
* | ||
* 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 org.springframework.boot.buildpack.platform.docker.configuration; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
|
||
import org.springframework.boot.buildpack.platform.json.SharedObjectMapper; | ||
import org.springframework.util.Base64Utils; | ||
|
||
/** | ||
* Docker registry authentication configuration. | ||
* | ||
* @author Scott Frederick | ||
* @since 2.4.0 | ||
*/ | ||
public abstract class DockerRegistryAuthentication { | ||
|
||
public String createAuthHeader() { | ||
try { | ||
return Base64Utils.encodeToUrlSafeString(SharedObjectMapper.get().writeValueAsBytes(this)); | ||
} | ||
catch (JsonProcessingException ex) { | ||
throw new IllegalStateException("Error creating Docker registry authentication header", ex); | ||
} | ||
} | ||
|
||
} |
129 changes: 0 additions & 129 deletions
129
...ngframework/boot/buildpack/platform/docker/configuration/DockerRegistryConfiguration.java
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...ework/boot/buildpack/platform/docker/configuration/DockerRegistryTokenAuthentication.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,39 @@ | ||
/* | ||
* Copyright 2012-2020 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 | ||
* | ||
* 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 org.springframework.boot.buildpack.platform.docker.configuration; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* Docker registry authentication configuration using a token. | ||
* | ||
* @author Scott Frederick | ||
*/ | ||
class DockerRegistryTokenAuthentication extends DockerRegistryAuthentication { | ||
|
||
@JsonProperty("identitytoken") | ||
private final String token; | ||
|
||
DockerRegistryTokenAuthentication(String token) { | ||
this.token = token; | ||
} | ||
|
||
String getToken() { | ||
return this.token; | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...mework/boot/buildpack/platform/docker/configuration/DockerRegistryUserAuthentication.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,63 @@ | ||
/* | ||
* Copyright 2012-2020 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 | ||
* | ||
* 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 org.springframework.boot.buildpack.platform.docker.configuration; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
/** | ||
* Docker registry authentication configuration using user credentials. | ||
* | ||
* @author Scott Frederick | ||
*/ | ||
class DockerRegistryUserAuthentication extends DockerRegistryAuthentication { | ||
|
||
@JsonProperty | ||
private final String username; | ||
|
||
@JsonProperty | ||
private final String password; | ||
|
||
@JsonProperty("serveraddress") | ||
private final String url; | ||
|
||
@JsonProperty | ||
private final String email; | ||
|
||
DockerRegistryUserAuthentication(String username, String password, String url, String email) { | ||
this.username = username; | ||
this.password = password; | ||
this.url = url; | ||
this.email = email; | ||
} | ||
|
||
String getUsername() { | ||
return this.username; | ||
} | ||
|
||
String getPassword() { | ||
return this.password; | ||
} | ||
|
||
String getUrl() { | ||
return this.url; | ||
} | ||
|
||
String getEmail() { | ||
return this.email; | ||
} | ||
|
||
} |
Oops, something went wrong.