Java 8 Oid - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Oid class.

This code example shows how to use the following methods:
    } 
 
    @Override 
    public String run() throws Exception {
      // This Oid for Kerberos GSS-API mechanism. 
      Oid mechOid = new Oid("1.2.840.113554.1.2.2");
      // Oid for kerberos principal name 
      Oid krb5PrincipalOid = new Oid("1.2.840.113554.1.2.2.1");
      GSSManager manager = GSSManager.getInstance();
      // GSS name for server 
      GSSName serverName = manager.createName(serverPrincipal, krb5PrincipalOid);
      // Create a GSSContext for authentication with the service. 
      // We're passing client credentials as null since we want them to be read from the Subject. 
      GSSContext gssContext =
          manager.createContext(serverName, mechOid, null, GSSContext.DEFAULT_LIFETIME);
      gssContext.requestMutualAuth(false);
      // Establish context 
      byte[] inToken = new byte[0];
      byte[] outToken = gssContext.initSecContext(inToken, 0, inToken.length);
      gssContext.dispose();
6
CodeRank
This code example shows how to use the following methods:
    } 
 
    protected GSSContext createGSSContext() throws GSSException {
        boolean useKerberosOid = MessageUtils.isTrue(
            messageContext.getContextualProperty(PROPERTY_USE_KERBEROS_OID));
        Oid oid = new Oid(useKerberosOid ? KERBEROS_OID : SPNEGO_OID);
 
        GSSManager gssManager = GSSManager.getInstance();
         
        String spn = getCompleteServicePrincipalName();
        GSSName gssService = gssManager.createName(spn, null);
         
        return gssManager.createContext(gssService.canonicalize(oid), 
                   oid, null, GSSContext.DEFAULT_LIFETIME);
    } 
     
    protected Subject loginAndGetSubject() throws LoginException {
         
        // The login without a callback can work if 
        // - Kerberos keytabs are used with a principal name set in the JAAS config 
6
CodeRank
This code example shows how to use the following methods:
        return super.authenticate(credentials, request, context); 
    } 
 
    @Override 
    protected byte[] generateToken(final byte[] input, final String authServer) throws GSSException { 
        return generateGSSToken(input, new Oid(SPNEGO_OID), authServer); 
    } 
 
    /** 
     * There are no valid parameters for SPNEGO authentication so this 
     * method always returns <code>null</code>. 
     * 
     * @return <code>null</code> 
     */ 
    public String getParameter(String name) { 
        if (name == null) { 
            throw new IllegalArgumentException("Parameter name may not be null"); 
        } 
        return null; 
    } 

6
CodeRank
This code example shows how to use the following methods:
        return super.authenticate(credentials, request, context); 
    } 
 
    @Override 
    protected byte[] generateToken(final byte[] input, final String authServer) throws GSSException { 
        return generateGSSToken(input, new Oid(KERBEROS_OID), authServer); 
    } 
 
    /** 
     * There are no valid parameters for KERBEROS authentication so this 
     * method always returns <code>null</code>. 
     * 
     * @return <code>null</code> 
     */ 
    public String getParameter(String name) { 
        if (name == null) { 
            throw new IllegalArgumentException("Parameter name may not be null"); 
        } 
        return null; 
    } 

6
CodeRank
This code example shows how to use the following methods:
    /** 
     * Produces Negotiate authorization Header based on token created by 
     * processChallenge. 
     * 
     * @param credentials Never used be the Negotiate scheme but must be provided to 
     * satisfy common-httpclient API. Credentials from JAAS will be used instead. 
     * @param request The request being authenticated 
     * 
     * @throws AuthenticationException if authorisation string cannot 
     *   be generated due to an authentication failure 
     * 
     * @return an Negotiate authorisation Header 
     */ 
    @Override 
    public Header authenticate(
            final Credentials credentials, 
            final HttpRequest request,
            final HttpContext context) throws AuthenticationException { 
        return super.authenticate(credentials, request, context);
    } 

5
CodeRank
This code example shows how to use the following methods:
5
CodeRank
This code example shows how to use the following methods:
        return super.generateToken(input, authServer); 
    } 
 
    @Override 
    protected byte[] generateToken(final byte[] input, final String authServer, final Credentials credentials) throws GSSException { 
        return generateGSSToken(input, new Oid(KERBEROS_OID), authServer, credentials); 
    } 
 
    /** 
     * There are no valid parameters for KERBEROS authentication so this 
     * method always returns {@code null}. 
     * 
     * @return {@code null} 
     */ 
    @Override 
    public String getParameter(final String name) { 
        Args.notNull(name, "Parameter name"); 
        return null; 
    } 
 
4
CodeRank
This code example shows how to use the following methods:
    static 
    { 
        Oid oid;
        try 
        { 
            oid = new Oid(KRB5_OID_STR);
        } 
        catch (GSSException ignore)
        { 
            oid = null;
        } 
 
        KRB5_OID = oid;
    } 
 
    private final ConnectionURL _connectionURL;
    private HeartbeatListener _heartbeatListener = HeartbeatListener.DEFAULT;
 
    /** 
     * @param settings 
4
CodeRank
This code example shows how to use the following methods:
        } catch (IOException ioe) {
            System.err.println(ioe);
        } 
 
        try { 
            new Oid(s);
            throw new Exception("should be invalid Oid");
        } catch (GSSException gsse) {
            ; 
        } 
 
        try { 
            new EncryptedPrivateKeyInfo(s, new byte[8]);
            throw new Exception("should be invalid algorithm");
        } catch (NoSuchAlgorithmException e) {
            ; 
        } 
    } 
} 
4
CodeRank
This code example shows how to use the following methods:
    // Create the OIDs 
 
    try { 
      SPNEGO = new Oid(ID_SPNEGO); 
 
      KERBEROS5 = new Oid(ID_KERBEROS5); 
      MSKERBEROS5 = new Oid(ID_MSKERBEROS5); 
      KRB5USERTOUSER = new Oid(ID_KRB5USERTOUSER); 
       
      NTLMSSP = new Oid(ID_NTLMSSP); 
    } 
    catch (GSSException ex) { 
    } 
  } 
} 
4
CodeRank
See Code Examples for Java 8 Oid Methods: