Tabnine Logo
GSSName.toString
Code IndexAdd Tabnine to your IDE (free)

How to use
toString
method
in
org.ietf.jgss.GSSName

Best Java code snippets using org.ietf.jgss.GSSName.toString (Showing top 20 results out of 657)

origin: wildfly/wildfly

Principal getPrincipal() {
  if (!isEstablished()) {
    throw new IllegalStateException("No established GSSContext to use for the Principal.");
  }
  if (principal == null) {
    try {
      principal = new KerberosPrincipal(gssContext.getSrcName().toString());
    } catch (GSSException e) {
      throw new IllegalStateException("Unable to create Principal", e);
    }
  }
  return principal;
}
origin: wildfly/wildfly

private void storeBoundServerName() throws SaslException {
  try {
    String targetName = gssContext.getTargName().toString();
    String[] targetNameParts = targetName.split("[/@]");
    boundServerName = targetNameParts.length > 1 ? targetNameParts[1] : targetName;
  } catch (GSSException e) {
    throw saslGs2.mechUnableToDetermineBoundServerName(e).toSaslException();
  }
}
origin: prestodb/presto

private Optional<Principal> authenticate(String token)
{
  GSSContext context = doAs(loginContext.getSubject(), () -> gssManager.createContext(serverCredential));
  try {
    byte[] inputToken = Base64.getDecoder().decode(token);
    context.acceptSecContext(inputToken, 0, inputToken.length);
    // We can't hold on to the GSS context because HTTP is stateless, so fail
    // if it can't be set up in a single challenge-response cycle
    if (context.isEstablished()) {
      return Optional.of(new KerberosPrincipal(context.getSrcName().toString()));
    }
    LOG.debug("Failed to establish GSS context for token %s", token);
  }
  catch (GSSException e) {
    // ignore and fail the authentication
    LOG.debug(e, "Authentication failed for token %s", token);
  }
  finally {
    try {
      context.dispose();
    }
    catch (GSSException e) {
      // ignore
    }
  }
  return Optional.empty();
}
origin: wildfly/wildfly

public static String validateSecurityContext(Subject subject, final byte[] serviceTicket) throws GSSException {
  // Accept the context and return the client principal name.
  return Subject.doAs(subject, (PrivilegedAction<String>)() -> {
    try {
      // Identify the server that communications are being made
      // to.
      GSSManager manager = GSSManager.getInstance();
      GSSContext context = manager.createContext((GSSCredential) null);
      context.acceptSecContext(serviceTicket, 0, serviceTicket.length);
      return context.getSrcName().toString();
    } catch (Exception e) {
      log.error(Util.getMessage("Krb5TokenKerberosContextProcessingException"),e);
      return null;
    }
  });
}

origin: wildfly/wildfly

subject.getPrincipals().add(new KerberosPrincipal(gssName.toString()));
origin: apache/hbase

    "provided by the client.");
 return SecurityUtil.getUserFromPrincipal(gssContext.getSrcName().toString());
} catch (GSSException e) {
 throw new HttpAuthenticationException("Kerberos authentication failed: ", e);
origin: wildfly/wildfly

private void checkAuthorizationID() throws SaslException {
  final String authenticationID;
  try {
    authenticationID = gssContext.getSrcName().toString();
  } catch (GSSException e) {
    throw saslGs2.mechUnableToDeterminePeerName(e).toSaslException();
  }
  saslGs2.tracef("checking if [%s] is authorized to act as [%s]...", authenticationID, authorizationID);
  if (authorizationID == null || authorizationID.isEmpty()) {
    authorizationID = authenticationID;
  }
  AuthorizeCallback authorizeCallback = new AuthorizeCallback(authenticationID, authorizationID);
  handleCallbacks(authorizeCallback);
  if (! authorizeCallback.isAuthorized()) {
    throw saslGs2.mechAuthorizationFailed(authenticationID, authorizationID).toSaslException();
  }
  saslGs2.trace("authorization id check successful");
}
origin: apache/incubator-druid

 log.trace("SPNEGO in progress");
} else {
 String clientPrincipal = gssContext.getSrcName().toString();
 KerberosName kerberosName = new KerberosName(clientPrincipal);
 String userName = kerberosName.getShortName();
origin: apache/hive

return getPrincipalWithoutRealmAndHost(gssContext.getSrcName().toString());
origin: wildfly/wildfly

dataSourceConfiguration.connectionPoolConfiguration().connectionFactoryConfiguration().principal(new NamePrincipal(kerberosCredential.getGssCredential().getName().toString()));
origin: wildfly/wildfly

String clientName = srcName.toString();
origin: hector-client/hector

public static String getSourcePrinciple(GSSContext context) {
 try {
  return context.getSrcName().toString();
 } catch (GSSException e) {
  throw new RuntimeException(e);
 }
}

origin: org.eclipse.jetty/jetty-security

private String toUserName(GSSContext gssContext)
{
  try
  {
    String name = gssContext.getSrcName().toString();
    int at = name.indexOf('@');
    if (at < 0)
      return name;
    return name.substring(0, at);
  }
  catch (GSSException x)
  {
    throw new RuntimeException(x);
  }
}
origin: wildfly/wildfly

  String targetName = gssContext.getTargName().toString();
  String[] targetNameParts = targetName.split("[/@]");
  boundServerName = targetNameParts.length > 1 ? targetNameParts[1] : targetName;
  authenticationId = gssContext.getSrcName().toString();
} catch (GSSException e) {
  throw saslGssapi.mechUnableToDeterminePeerName(e).toSaslException();
origin: org.eclipse.jetty/jetty-security

String clientName = gContext.getSrcName().toString();
String role = clientName.substring(clientName.indexOf('@') + 1);
origin: org.hectorclient/hector-core

public static String getSourcePrinciple(GSSContext context) {
 try {
  return context.getSrcName().toString();
 } catch (GSSException e) {
  throw new RuntimeException(e);
 }
}

origin: io.undertow/undertow-core

Principal getPrincipal() {
  if (!isEstablished()) {
    throw new IllegalStateException("No established GSSContext to use for the Principal.");
  }
  if (principal == null) {
    try {
      principal = new KerberosPrincipal(gssContext.getSrcName().toString());
    } catch (GSSException e) {
      throw new IllegalStateException("Unable to create Principal", e);
    }
  }
  return principal;
}
origin: org.wildfly.security/wildfly-elytron

private void storeBoundServerName() throws SaslException {
  try {
    String targetName = gssContext.getTargName().toString();
    String[] targetNameParts = targetName.split("[/@]");
    boundServerName = targetNameParts.length > 1 ? targetNameParts[1] : targetName;
  } catch (GSSException e) {
    throw saslGs2.mechUnableToDetermineBoundServerName(e).toSaslException();
  }
}
origin: net.shibboleth.idp/idp-authn-impl

  public String run() throws GSSException {
    final GSSContext serverCtx = manager.createContext((GSSCredential) null);
    serverCtx.acceptSecContext(token, 0, token.length);
    final String s = serverCtx.getSrcName().toString();
    serverCtx.dispose();
    return s;
  }
});
origin: org.wildfly.security/wildfly-elytron-sasl-gs2

private void storeBoundServerName() throws SaslException {
  try {
    String targetName = gssContext.getTargName().toString();
    String[] targetNameParts = targetName.split("[/@]");
    boundServerName = targetNameParts.length > 1 ? targetNameParts[1] : targetName;
  } catch (GSSException e) {
    throw saslGs2.mechUnableToDetermineBoundServerName(e).toSaslException();
  }
}
org.ietf.jgssGSSNametoString

Popular methods of GSSName

  • canonicalize
  • export
  • equals
  • isAnonymous
  • hashCode

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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