Tabnine Logo
AuthCredentialsType.valueOf
Code IndexAdd Tabnine to your IDE (free)

How to use
valueOf
method
in
com.vmware.photon.controller.model.security.util.AuthCredentialsType

Best Java code snippets using com.vmware.photon.controller.model.security.util.AuthCredentialsType.valueOf (Showing top 4 results out of 315)

origin: vmware/admiral

public static String createAuthorizationHeader(AuthCredentialsServiceState authState) {
  if (authState == null) {
    return null;
  }
  if (AuthCredentialsType.Bearer.toString().equals(authState.type)) {
    String token = EncryptionUtils.decrypt(authState.privateKey);
    return "Bearer " + token;
  }
  AuthCredentialsType authCredentialsType = AuthCredentialsType.valueOf(authState.type);
  if (AuthCredentialsType.Password == authCredentialsType) {
    String username = authState.userEmail;
    String password = EncryptionUtils.decrypt(authState.privateKey);
    String code = new String(Base64.getEncoder().encode(
        (username + ":" + password).getBytes()));
    return "Basic " + code;
  }
  return null;
}
origin: vmware/admiral

public static KubeConfig constructKubeConfig(String clusterAddress,
    AuthCredentialsServiceState credentials) {
  KubeConfig config = createKubeConfig(clusterAddress);
  KubeConfig.UserEntry userEntry = new KubeConfig.UserEntry();
  userEntry.name = config.contexts.get(0).context.user;
  userEntry.user = new KubeConfig.AuthInfo();
  config.users = Arrays.asList(userEntry);
  AuthCredentialsType credentialsType = AuthCredentialsType.valueOf(credentials.type);
  switch (credentialsType) {
  case Bearer:
    userEntry.user.token = EncryptionUtils.decrypt(credentials.privateKey);
    break;
  case PublicKey:
    userEntry.user.clientCertificateData = new String(
        Base64.getEncoder().encode(credentials.publicKey.getBytes()));
    userEntry.user.clientKeyData = new String(Base64.getEncoder()
        .encode(EncryptionUtils.decrypt(credentials.privateKey).getBytes()));
    break;
  case Password:
    userEntry.user.username = credentials.userEmail;
    userEntry.user.password = EncryptionUtils.decrypt(credentials.privateKey);
    break;
  default:
    throw new LocalizableValidationException("Unsupported credentials type",
        "adapter.unsuported.auth.credentials.type");
  }
  return config;
}
origin: vmware/admiral

/**
 * Login in PKS and returns PKS context instance with token.
 */
private DeferredResult<PKSContext> login(Endpoint endpoint,
    AuthCredentialsServiceState authCredentials) {
  if (authCredentials == null) {
    return DeferredResult.completed(PKSContext.create(endpoint, null));
  }
  AuthCredentialsType authCredentialsType = AuthCredentialsType.valueOf(authCredentials.type);
  if (AuthCredentialsType.Password == authCredentialsType) {
    String username = authCredentials.userEmail;
    String password = EncryptionUtils.decrypt(authCredentials.privateKey);
    return getClient()
        .login(endpoint.uaaEndpoint, username, password)
        .thenApply(uaaTokenResponse -> PKSContext.create(endpoint, uaaTokenResponse));
  }
  throw new IllegalArgumentException("Credential type " + authCredentialsType.name()
      + " is not supported");
}
origin: vmware/admiral

if (registryState.authCredentials != null) {
  AuthCredentialsServiceState authState = registryState.authCredentials;
  AuthCredentialsType authType = AuthCredentialsType.valueOf(authState.type);
  if (AuthCredentialsType.Password == authType) {
com.vmware.photon.controller.model.security.utilAuthCredentialsTypevalueOf

Popular methods of AuthCredentialsType

  • toString
  • name

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • findViewById (Activity)
  • startActivity (Activity)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JOptionPane (javax.swing)
  • JPanel (javax.swing)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now