@Override public String getFqn() { return this.getWindowsAccount().fqn; }
@Override public boolean isGuest() { for (final Account userGroup : this.getUserGroups()) { if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinBuiltinGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountDomainGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountGuestSid)) { return true; } } return Advapi32Util.isWellKnownSid(this.getSid(), WELL_KNOWN_SID_TYPE.WinAnonymousSid); } }
@Override public IWindowsIdentity getIdentity() { final HANDLEByReference phContextToken = new HANDLEByReference(); final int rc = Secur32.INSTANCE.QuerySecurityContextToken(this.ctx, phContextToken); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return new WindowsIdentityImpl(phContextToken.getValue()); }
@Override public IWindowsAccount[] getGroups() { final Account[] groups = this.getUserGroups(); final List<IWindowsAccount> result = new ArrayList<>(groups.length); for (final Account userGroup : groups) { final WindowsAccountImpl account = new WindowsAccountImpl(userGroup); result.add(account); } return result.toArray(new IWindowsAccount[0]); }
@Override public boolean isGuest() { for (final Account userGroup : this.getUserGroups()) { if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinBuiltinGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountDomainGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountGuestSid)) { return true; } } return Advapi32Util.isWellKnownSid(this.getSid(), WELL_KNOWN_SID_TYPE.WinAnonymousSid); } }
@Override public IWindowsIdentity getIdentity() { final HANDLEByReference phContextToken = new HANDLEByReference(); final int rc = Secur32.INSTANCE.QuerySecurityContextToken(this.ctx, phContextToken); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return new WindowsIdentityImpl(phContextToken.getValue()); }
@Override public IWindowsAccount[] getGroups() { final Account[] groups = this.getUserGroups(); final List<IWindowsAccount> result = new ArrayList<>(groups.length); for (final Account userGroup : groups) { final WindowsAccountImpl account = new WindowsAccountImpl(userGroup); result.add(account); } return result.toArray(new IWindowsAccount[0]); }
@Override public boolean isGuest() { for (final Account userGroup : this.getUserGroups()) { if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinBuiltinGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountDomainGuestsSid)) { return true; } if (Advapi32Util.isWellKnownSid(userGroup.sid, WELL_KNOWN_SID_TYPE.WinAccountGuestSid)) { return true; } } return Advapi32Util.isWellKnownSid(this.getSid(), WELL_KNOWN_SID_TYPE.WinAnonymousSid); } }
@Override public byte[] getSid() { return this.getWindowsAccount().sid; }
@Override public IWindowsIdentity getIdentity() { final HANDLEByReference phContextToken = new HANDLEByReference(); final int rc = Secur32.INSTANCE.QuerySecurityContextToken(this.ctx, phContextToken); if (WinError.SEC_E_OK != rc) { throw new Win32Exception(rc); } return new WindowsIdentityImpl(phContextToken.getValue()); }
@Override public IWindowsAccount[] getGroups() { final Account[] groups = this.getUserGroups(); final List<IWindowsAccount> result = new ArrayList<>(groups.length); for (final Account userGroup : groups) { final WindowsAccountImpl account = new WindowsAccountImpl(userGroup); result.add(account); } return result.toArray(new IWindowsAccount[0]); }
@Override public String getSidString() { return this.getWindowsAccount().sidString; }
@Override public IWindowsIdentity logonDomainUserEx(final String username, final String domain, final String password, final int logonType, final int logonProvider) { final HANDLEByReference phUser = new HANDLEByReference(); if (!Advapi32.INSTANCE.LogonUser(username, domain, password, logonType, logonProvider, phUser)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } return new WindowsIdentityImpl(phUser.getValue()); }
@Override public String getFqn() { return this.getWindowsAccount().fqn; }
@Override public IWindowsIdentity logonDomainUserEx(final String username, final String domain, final String password, final int logonType, final int logonProvider) { final HANDLEByReference phUser = new HANDLEByReference(); if (!Advapi32.INSTANCE.LogonUser(username, domain, password, logonType, logonProvider, phUser)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } return new WindowsIdentityImpl(phUser.getValue()); }
@Override public String getFqn() { return this.getWindowsAccount().fqn; }
@Override public IWindowsIdentity logonDomainUserEx(final String username, final String domain, final String password, final int logonType, final int logonProvider) { final HANDLEByReference phUser = new HANDLEByReference(); if (!Advapi32.INSTANCE.LogonUser(username, domain, password, logonType, logonProvider, phUser)) { throw new Win32Exception(Kernel32.INSTANCE.GetLastError()); } return new WindowsIdentityImpl(phUser.getValue()); }
@Override public String getSidString() { return this.getWindowsAccount().sidString; }
@Override public String getSidString() { return this.getWindowsAccount().sidString; }
@Override public byte[] getSid() { return this.getWindowsAccount().sid; }