Package com.sun.jna.platform.win32.Sspi

Examples of com.sun.jna.platform.win32.Sspi.CredHandle


          phCredential));
    }
   
    public void testAcceptSecurityContext() {
      // client ----------- acquire outbound credential handle
      CredHandle phClientCredential = new CredHandle();
      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
View Full Code Here


          phClientCredential));
    }
   
    public void testImpersonateRevertSecurityContext() {
      // client ----------- acquire outbound credential handle
      CredHandle phClientCredential = new CredHandle();
      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
View Full Code Here

          pPackageInfo.getPointer()));
    }
   
    public void testQuerySecurityContextToken() {
      // client ----------- acquire outbound credential handle
      CredHandle phClientCredential = new CredHandle();
      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_OUTBOUND, null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      IntByReference pfClientContextAttr = new IntByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", Sspi.SECPKG_CRED_INBOUND, null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
View Full Code Here

            // client credentials handle
            try {
                final String username = CurrentWindowsCredentials.getCurrentUsername();
                final TimeStamp lifetime = new TimeStamp();

                clientCred = new CredHandle();
                final int rc = Secur32.INSTANCE.AcquireCredentialsHandle(username,
                        scheme, Sspi.SECPKG_CRED_OUTBOUND, null, null, null, null,
                        clientCred, lifetime);

                if (WinError.SEC_E_OK != rc) {
View Full Code Here

            // client credentials handle
            try {
                final String username = CurrentWindowsCredentials.getCurrentUsername();
                final TimeStamp lifetime = new TimeStamp();

                clientCred = new CredHandle();
                final int rc = Secur32.INSTANCE.AcquireCredentialsHandle(username,
                        scheme, Sspi.SECPKG_CRED_OUTBOUND, null, null, null, null,
                        clientCred, lifetime);

                if (WinError.SEC_E_OK != rc) {
View Full Code Here

            // client credentials handle
            try {
                final String username = CurrentWindowsCredentials.getCurrentUsername();
                final TimeStamp lifetime = new TimeStamp();

                clientCred = new CredHandle();
                final int rc = Secur32.INSTANCE.AcquireCredentialsHandle(username,
                        scheme, Sspi.SECPKG_CRED_OUTBOUND, null, null, null, null,
                        clientCred, lifetime);

                if (WinError.SEC_E_OK != rc) {
View Full Code Here

      String username = Native.toString(buffer);
      assertTrue(username.length() > 0);
    }
   
    public void testAcquireCredentialsHandle() {
      CredHandle phCredential = new CredHandle();
      TimeStamp ptsExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phCredential, ptsExpiry));
      assertTrue(phCredential.dwLower != null);
View Full Code Here

      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.FreeCredentialsHandle(
          phCredential));     
    }
   
    public void testAcquireCredentialsHandleInvalidPackage() {
      CredHandle phCredential = new CredHandle();
      TimeStamp ptsExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_SECPKG_NOT_FOUND, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "PackageDoesntExist", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phCredential, ptsExpiry));
    }
View Full Code Here

          null, "PackageDoesntExist", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phCredential, ptsExpiry));
    }
   
    public void testInitializeSecurityContext() {
      CredHandle phCredential = new CredHandle();
      TimeStamp ptsExpiry = new TimeStamp();
      // acquire a credentials handle
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phCredential, ptsExpiry));
View Full Code Here

          phCredential));
    }
   
    public void testAcceptSecurityContext() {
      // client ----------- acquire outbound credential handle
      CredHandle phClientCredential = new CredHandle();
      TimeStamp ptsClientExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_OUTBOUND), null, null, null,
          null, phClientCredential, ptsClientExpiry));
      // client ----------- security context
      CtxtHandle phClientContext = new CtxtHandle();
      NativeLongByReference pfClientContextAttr = new NativeLongByReference();
    // server ----------- acquire inbound credential handle
      CredHandle phServerCredential = new CredHandle();
      TimeStamp ptsServerExpiry = new TimeStamp();
      assertEquals(W32Errors.SEC_E_OK, Secur32.INSTANCE.AcquireCredentialsHandle(
          null, "Negotiate", new NativeLong(Sspi.SECPKG_CRED_INBOUND), null, null, null,
          null, phServerCredential, ptsServerExpiry));
      // server ----------- security context
View Full Code Here

TOP

Related Classes of com.sun.jna.platform.win32.Sspi.CredHandle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.