-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-50204] Implemented the credentials page
- Loading branch information
Steve Arch
committed
Apr 12, 2018
1 parent
176376f
commit d272a6e
Showing
3 changed files
with
75 additions
and
4 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
58 changes: 58 additions & 0 deletions
58
...cloudbees/jenkins/plugins/kubernetes_credentials_provider/KubernetesCredentialsStore.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,58 @@ | ||
package com.cloudbees.jenkins.plugins.kubernetes_credentials_provider; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import org.acegisecurity.Authentication; | ||
import org.apache.commons.lang.NotImplementedException; | ||
import hudson.model.ModelObject; | ||
import hudson.security.ACL; | ||
import hudson.security.Permission; | ||
import jenkins.model.Jenkins; | ||
import com.cloudbees.plugins.credentials.Credentials; | ||
import com.cloudbees.plugins.credentials.CredentialsStore; | ||
import com.cloudbees.plugins.credentials.domains.Domain; | ||
|
||
public class KubernetesCredentialsStore extends CredentialsStore { | ||
|
||
private final KubernetesCredentialProvider provider; | ||
|
||
public KubernetesCredentialsStore(KubernetesCredentialProvider provider) { | ||
super(KubernetesCredentialProvider.class); | ||
this.provider = provider; | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public ModelObject getContext() { | ||
return Jenkins.getInstance(); | ||
} | ||
|
||
@Override | ||
public boolean hasPermission(@NonNull Authentication authentication, @NonNull Permission permission) { | ||
return Jenkins.getInstance().getACL().hasPermission(authentication, permission); | ||
} | ||
|
||
@NonNull | ||
@Override | ||
public List<Credentials> getCredentials(@NonNull Domain domain) { | ||
// TODO: Filter by domain - how do I do this? | ||
return provider.getCredentials(Credentials.class, Jenkins.getInstance(), ACL.SYSTEM); | ||
} | ||
|
||
@Override | ||
public boolean addCredentials(@NonNull Domain domain, @NonNull Credentials credentials) { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public boolean removeCredentials(@NonNull Domain domain, @NonNull Credentials credentials) { | ||
throw new NotImplementedException(); | ||
} | ||
|
||
@Override | ||
public boolean updateCredentials(@NonNull Domain domain, @NonNull Credentials current, | ||
@NonNull Credentials replacement) { | ||
throw new NotImplementedException(); | ||
} | ||
} |