-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PluginInfo V3 will now render plugin setting configuration
- Loading branch information
Showing
108 changed files
with
2,257 additions
and
570 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
37 changes: 37 additions & 0 deletions
37
...ss/src/com/thoughtworks/go/plugin/access/authentication/AuthenticationMetadataLoader.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,37 @@ | ||
/* | ||
* Copyright 2017 ThoughtWorks, Inc. | ||
* | ||
* 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 com.thoughtworks.go.plugin.access.authentication; | ||
|
||
import com.thoughtworks.go.plugin.access.common.MetadataLoader; | ||
import com.thoughtworks.go.plugin.domain.authentication.AuthenticationPluginInfo; | ||
import com.thoughtworks.go.plugin.infra.PluginManager; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Deprecated | ||
@Component | ||
public class AuthenticationMetadataLoader extends MetadataLoader<AuthenticationPluginInfo> { | ||
@Autowired | ||
public AuthenticationMetadataLoader(PluginManager pluginManager, AuthenticationPluginInfoBuilder builder, AuthenticationExtension extension) { | ||
this(pluginManager, AuthenticationMetadataStore.instance(), builder, extension); | ||
} | ||
|
||
protected AuthenticationMetadataLoader(PluginManager pluginManager, AuthenticationMetadataStore metadataStore, AuthenticationPluginInfoBuilder builder, AuthenticationExtension extension) { | ||
super(pluginManager, builder, metadataStore, extension); | ||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...src/com/thoughtworks/go/plugin/access/authentication/AuthenticationPluginInfoBuilder.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,55 @@ | ||
/* | ||
* Copyright 2017 ThoughtWorks, Inc. | ||
* | ||
* 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 com.thoughtworks.go.plugin.access.authentication; | ||
|
||
import com.thoughtworks.go.plugin.access.authentication.models.AuthenticationPluginConfiguration; | ||
import com.thoughtworks.go.plugin.access.common.PluginInfoBuilder; | ||
import com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration; | ||
import com.thoughtworks.go.plugin.domain.authentication.AuthenticationPluginInfo; | ||
import com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings; | ||
import com.thoughtworks.go.plugin.domain.common.PluginView; | ||
import com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Deprecated | ||
@Component | ||
public class AuthenticationPluginInfoBuilder implements PluginInfoBuilder<AuthenticationPluginInfo> { | ||
|
||
private AuthenticationExtension extension; | ||
|
||
@Autowired | ||
public AuthenticationPluginInfoBuilder(AuthenticationExtension extension) { | ||
this.extension = extension; | ||
} | ||
|
||
public AuthenticationPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) { | ||
PluginSettingsConfiguration pluginSettingsConfiguration = extension.getPluginSettingsConfiguration(descriptor.id()); | ||
String pluginSettingsView = extension.getPluginSettingsView(descriptor.id()); | ||
AuthenticationPluginConfiguration pluginConfiguration = extension.getPluginConfiguration(descriptor.id()); | ||
|
||
PluggableInstanceSettings pluggableInstanceSettings = new PluggableInstanceSettings(configurations(pluginSettingsConfiguration), new PluginView(pluginSettingsView)); | ||
return new AuthenticationPluginInfo(descriptor, | ||
pluginConfiguration.getDisplayName(), | ||
pluginConfiguration.getDisplayImageURL(), | ||
pluginConfiguration.supportsPasswordBasedAuthentication(), | ||
pluginConfiguration.supportsWebBasedAuthentication(), | ||
pluggableInstanceSettings); | ||
} | ||
|
||
} | ||
|
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
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
39 changes: 39 additions & 0 deletions
39
...-plugin-access/src/com/thoughtworks/go/plugin/access/common/models/ImageDeserializer.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 2017 ThoughtWorks, Inc. | ||
* | ||
* 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 com.thoughtworks.go.plugin.access.common.models; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.reflect.TypeToken; | ||
|
||
import java.util.Map; | ||
|
||
import static org.apache.commons.codec.digest.DigestUtils.sha256Hex; | ||
|
||
public class ImageDeserializer { | ||
|
||
public com.thoughtworks.go.plugin.domain.common.Image fromJSON(String jsonString) { | ||
Map<String, String> json = new Gson().fromJson(jsonString, new TypeToken<Map<String, String>>() { | ||
}.getType()); | ||
String contentType = json.get("content_type"); | ||
String data = json.get("data"); | ||
return new com.thoughtworks.go.plugin.domain.common.Image(contentType, data, hash(contentType, data)); | ||
} | ||
|
||
private String hash(String contentType, String data) { | ||
return sha256Hex("data:" + contentType + ";base64," + data); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...gin-access/src/com/thoughtworks/go/plugin/access/configrepo/ConfigRepoMetadataLoader.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,36 @@ | ||
/* | ||
* Copyright 2017 ThoughtWorks, Inc. | ||
* | ||
* 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 com.thoughtworks.go.plugin.access.configrepo; | ||
|
||
import com.thoughtworks.go.plugin.access.common.MetadataLoader; | ||
import com.thoughtworks.go.plugin.domain.configrepo.ConfigRepoPluginInfo; | ||
import com.thoughtworks.go.plugin.infra.PluginManager; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ConfigRepoMetadataLoader extends MetadataLoader<ConfigRepoPluginInfo> { | ||
@Autowired | ||
public ConfigRepoMetadataLoader(PluginManager pluginManager, ConfigRepoPluginInfoBuilder builder, ConfigRepoExtension extension) { | ||
this(pluginManager, ConfigRepoMetadataStore.instance(), builder, extension); | ||
} | ||
|
||
protected ConfigRepoMetadataLoader(PluginManager pluginManager, ConfigRepoMetadataStore metadataStore, ConfigRepoPluginInfoBuilder builder, ConfigRepoExtension extension) { | ||
super(pluginManager, builder, metadataStore, extension); | ||
} | ||
|
||
} |
47 changes: 47 additions & 0 deletions
47
...-access/src/com/thoughtworks/go/plugin/access/configrepo/ConfigRepoPluginInfoBuilder.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,47 @@ | ||
/* | ||
* Copyright 2017 ThoughtWorks, Inc. | ||
* | ||
* 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 com.thoughtworks.go.plugin.access.configrepo; | ||
|
||
import com.thoughtworks.go.plugin.access.common.PluginInfoBuilder; | ||
import com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration; | ||
import com.thoughtworks.go.plugin.domain.common.PluggableInstanceSettings; | ||
import com.thoughtworks.go.plugin.domain.common.PluginView; | ||
import com.thoughtworks.go.plugin.domain.configrepo.ConfigRepoPluginInfo; | ||
import com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class ConfigRepoPluginInfoBuilder implements PluginInfoBuilder<ConfigRepoPluginInfo> { | ||
|
||
private ConfigRepoExtension extension; | ||
|
||
@Autowired | ||
public ConfigRepoPluginInfoBuilder(ConfigRepoExtension extension) { | ||
this.extension = extension; | ||
} | ||
|
||
public ConfigRepoPluginInfo pluginInfoFor(GoPluginDescriptor descriptor) { | ||
PluginSettingsConfiguration pluginSettingsConfiguration = extension.getPluginSettingsConfiguration(descriptor.id()); | ||
String pluginSettingsView = extension.getPluginSettingsView(descriptor.id()); | ||
PluggableInstanceSettings pluginSettings = new PluggableInstanceSettings(configurations(pluginSettingsConfiguration), new PluginView(pluginSettingsView)); | ||
|
||
return new ConfigRepoPluginInfo(descriptor, pluginSettings); | ||
} | ||
|
||
} | ||
|
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.