test_class.file: agent/jvm/src/test/java/org/jolokia/jvmagent/security/ClientCertAuthenticatorTest.java
test_class.identifier: ClientCertAuthenticatorTest
test_class.superclass: extends BaseAuthenticatorTest
test_case.body: @Test
      public void negativeWithNoCert() throws Exception {
                  ClientCertAuthenticator auth = new ClientCertAuthenticator(getConfig("clientPrincipal","cn=roland",
                                                                               "extendedClientCheck","false"));
          Authenticator.Result result = auth.authenticate(createHttpsExchange(new Headers(),"uid=blub,cn=roland,o=redhat,c=de",
                                                                              false /* no cert */, false));
          assertTrue(result instanceof Authenticator.Failure);
      }
test_case.class_method_signature: ClientCertAuthenticatorTest.negativeWithNoCert()
test_case.full_signature: @Test public void negativeWithNoCert()
test_case.identifier: negativeWithNoCert
test_case.invocations: getConfig authenticate createHttpsExchange assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void negativeWithNoCert()
focal_class.declarator: CLIENTAUTH_OID = "1.3.6.1.5.5.7.3.2"
focal_class.modifier: static final
focal_class.original_string: static final String CLIENTAUTH_OID = "1.3.6.1.5.5.7.3.2";
focal_class.type: String
focal_class.var_name: CLIENTAUTH_OID
focal_class.declarator: useSslClientAuthentication
focal_class.modifier: private final
focal_class.original_string: private final boolean useSslClientAuthentication;
focal_class.type: boolean
focal_class.var_name: useSslClientAuthentication
focal_class.declarator: allowedPrincipals
focal_class.modifier: private final
focal_class.original_string: private final List<LdapName> allowedPrincipals;
focal_class.type: List<LdapName>
focal_class.var_name: allowedPrincipals
focal_class.declarator: extendedClientCheck
focal_class.modifier: private final
focal_class.original_string: private final boolean extendedClientCheck;
focal_class.type: boolean
focal_class.var_name: extendedClientCheck
focal_class.file: agent/jvm/src/main/java/org/jolokia/jvmagent/security/ClientCertAuthenticator.java
focal_class.identifier: ClientCertAuthenticator
focal_class.class_method_signature: ClientCertAuthenticator.ClientCertAuthenticator(JolokiaServerConfig pConfig)
focal_class.full_signature: public  ClientCertAuthenticator(JolokiaServerConfig pConfig)
focal_class.identifier: ClientCertAuthenticator
focal_class.modifiers: public
focal_class.parameters: (JolokiaServerConfig pConfig)
focal_class.signature:  ClientCertAuthenticator(JolokiaServerConfig pConfig)
focal_class.class_method_signature: ClientCertAuthenticator.authenticate(HttpExchange httpExchange)
focal_class.full_signature: @Override public Result authenticate(HttpExchange httpExchange)
focal_class.identifier: authenticate
focal_class.modifiers: @Override public
focal_class.parameters: (HttpExchange httpExchange)
focal_class.return: Result
focal_class.signature: Result authenticate(HttpExchange httpExchange)
focal_class.class_method_signature: ClientCertAuthenticator.getClientCert(HttpsExchange pHttpsExchange)
focal_class.full_signature: private X509Certificate getClientCert(HttpsExchange pHttpsExchange)
focal_class.identifier: getClientCert
focal_class.modifiers: private
focal_class.parameters: (HttpsExchange pHttpsExchange)
focal_class.return: X509Certificate
focal_class.signature: X509Certificate getClientCert(HttpsExchange pHttpsExchange)
focal_class.class_method_signature: ClientCertAuthenticator.checkCertForClientUsage(X509Certificate clientCert)
focal_class.full_signature: private void checkCertForClientUsage(X509Certificate clientCert)
focal_class.identifier: checkCertForClientUsage
focal_class.modifiers: private
focal_class.parameters: (X509Certificate clientCert)
focal_class.return: void
focal_class.signature: void checkCertForClientUsage(X509Certificate clientCert)
focal_class.class_method_signature: ClientCertAuthenticator.checkCertForAllowedPrincipals(HttpsExchange pHttpsExchange)
focal_class.full_signature: private void checkCertForAllowedPrincipals(HttpsExchange pHttpsExchange)
focal_class.identifier: checkCertForAllowedPrincipals
focal_class.modifiers: private
focal_class.parameters: (HttpsExchange pHttpsExchange)
focal_class.return: void
focal_class.signature: void checkCertForAllowedPrincipals(HttpsExchange pHttpsExchange)
focal_class.class_method_signature: ClientCertAuthenticator.getPrincipalRdns(X500Principal principal)
focal_class.full_signature: private Set<Rdn> getPrincipalRdns(X500Principal principal)
focal_class.identifier: getPrincipalRdns
focal_class.modifiers: private
focal_class.parameters: (X500Principal principal)
focal_class.return: Set<Rdn>
focal_class.signature: Set<Rdn> getPrincipalRdns(X500Principal principal)
focal_class.class_method_signature: ClientCertAuthenticator.parseAllowedPrincipals(JolokiaServerConfig pConfig)
focal_class.full_signature: private List<LdapName> parseAllowedPrincipals(JolokiaServerConfig pConfig)
focal_class.identifier: parseAllowedPrincipals
focal_class.modifiers: private
focal_class.parameters: (JolokiaServerConfig pConfig)
focal_class.return: List<LdapName>
focal_class.signature: List<LdapName> parseAllowedPrincipals(JolokiaServerConfig pConfig)
focal_class.superclass: extends Authenticator
focal_method.body: @Override
      public Result authenticate(HttpExchange httpExchange) {
          if( !(httpExchange instanceof HttpsExchange) ) {
              return new Failure(500);
          }
          try {
              HttpsExchange httpsExchange = (HttpsExchange) httpExchange;
              X509Certificate certificate = getClientCert(httpsExchange);
              if (certificate == null) {
                  return new Failure(401);
              }
              checkCertForClientUsage(certificate);
              checkCertForAllowedPrincipals(httpsExchange);
  
              String name="";
              try {
                  name = httpsExchange.getSSLSession().getPeerPrincipal().getName();
              } catch (SSLPeerUnverifiedException ignore) {
              }
              return new Success(new HttpPrincipal(name, "ssl"));
  
          } catch (SecurityException e) {
              return new Failure(403);
          }
      }
focal_method.class_method_signature: ClientCertAuthenticator.authenticate(HttpExchange httpExchange)
focal_method.full_signature: @Override public Result authenticate(HttpExchange httpExchange)
focal_method.identifier: authenticate
focal_method.invocations: getClientCert checkCertForClientUsage checkCertForAllowedPrincipals getName getPeerPrincipal getSSLSession
focal_method.modifiers: @Override public
focal_method.parameters: (HttpExchange httpExchange)
focal_method.return: Result
focal_method.signature: Result authenticate(HttpExchange httpExchange)