Package org.tmatesoft.svn.core.internal.util.jna.ISVNSecurityLibrary

Examples of org.tmatesoft.svn.core.internal.util.jna.ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY


        ISVNSecurityLibrary library = JNALibraryLoader.getSecurityLibrary();
        if (library == null) {
            return null;
        }

        SEC_WINNT_AUTH_IDENTITY authIdentity = null;
        if (user != null || password != null || domain != null) {
            authIdentity = new SEC_WINNT_AUTH_IDENTITY();
            if (user != null) {
                authIdentity.User = new WString(user);
                authIdentity.UserLength = new NativeLong(user.length());
            }
           
            if (password != null) {
                authIdentity.Password = new WString(password);
                authIdentity.PasswordLength = new NativeLong(password.length());
            }
           
            if (domain != null) {
                authIdentity.Domain = new WString(domain);
                authIdentity.DomainLength = new NativeLong(domain.length());
            }
            authIdentity.Flags = new NativeLong(ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY_UNICODE);
            authIdentity.write();
        }
       
        SecHandle pCred = new SecHandle();
        pCred.dwLower = new NativeLong(0);
        pCred.dwUpper = new NativeLong(0);
        pCred.write();

        ISVNSecurityLibrary.TimeStamp ltime = new ISVNSecurityLibrary.TimeStamp();
        ltime.HighPart = new NativeLong(0);
        ltime.LowPart = new NativeLong(0);
        ltime.write();
       
        int securityStatus = library.AcquireCredentialsHandleW(null, new WString("NTLM"),
                new NativeLong(ISVNSecurityLibrary.SECPKG_CRED_OUTBOUND), Pointer.NULL,
                authIdentity != null ? authIdentity.getPointer() : Pointer.NULL,
                        Pointer.NULL, Pointer.NULL, pCred.getPointer(), ltime.getPointer());
        if (securityStatus == 0) {
            pCred.read();
            return pCred;
        }
View Full Code Here


        ISVNSecurityLibrary library = JNALibraryLoader.getSecurityLibrary();
        if (library == null) {
            return null;
        }

        SEC_WINNT_AUTH_IDENTITY authIdentity = null;
        if (user != null || password != null || domain != null) {
            authIdentity = new SEC_WINNT_AUTH_IDENTITY();
            if (user != null) {
                authIdentity.User = new WString(user);
                authIdentity.UserLength = new NativeLong(user.length());
            }
           
            if (password != null) {
                authIdentity.Password = new WString(password);
                authIdentity.PasswordLength = new NativeLong(password.length());
            }
           
            if (domain != null) {
                authIdentity.Domain = new WString(domain);
                authIdentity.DomainLength = new NativeLong(domain.length());
            }
            authIdentity.Flags = new NativeLong(ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY_UNICODE);
            authIdentity.write();
        }
       
        SecHandle pCred = new SecHandle();
        pCred.dwLower = new NativeLong(0);
        pCred.dwUpper = new NativeLong(0);
        pCred.write();

        ISVNSecurityLibrary.TimeStamp ltime = new ISVNSecurityLibrary.TimeStamp();
        ltime.HighPart = new NativeLong(0);
        ltime.LowPart = new NativeLong(0);
        ltime.write();
       
        int securityStatus = library.AcquireCredentialsHandleW(null, new WString("NTLM"),
                new NativeLong(ISVNSecurityLibrary.SECPKG_CRED_OUTBOUND), Pointer.NULL,
                authIdentity != null ? authIdentity.getPointer() : Pointer.NULL,
                        Pointer.NULL, Pointer.NULL, pCred.getPointer(), ltime.getPointer());
        if (securityStatus == 0) {
            pCred.read();
            return pCred;
        }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.internal.util.jna.ISVNSecurityLibrary.SEC_WINNT_AUTH_IDENTITY

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.