Examples of WindowsAuthProviderImpl


Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

    // TODO This was commented out, uncommented and ignore until I can determine if this is valid
    @Ignore
    @Test
    public void testLogonGuestUser() {
        IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
        IWindowsIdentity identity = prov.logonUser("garbage", "garbage");
        LOGGER.debug("Fqn: {}", identity.getFqn());
        LOGGER.debug("Guest: {}", Boolean.valueOf(identity.isGuest()));
        assertTrue(identity.getFqn().endsWith("\\Guest"));
        assertTrue(identity.isGuest());
        identity.dispose();
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

        userInfo.usri1_password = new WString("!WAFFLEP$$Wrd0");
        userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
        // ignore test if not able to add user (need to be administrator to do this).
        assumeTrue(LMErr.NERR_Success == Netapi32.INSTANCE.NetUserAdd(null, 1, userInfo, null));
        try {
            IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
            IWindowsIdentity identity = prov.logonUser(userInfo.usri1_name.toString(),
                    userInfo.usri1_password.toString());
            assertTrue(identity.getFqn().endsWith("\\" + userInfo.usri1_name.toString()));
            assertFalse(identity.isGuest());
            identity.dispose();
        } finally {
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

        userInfo.usri1_password = new WString(MockWindowsAccount.TEST_PASSWORD);
        userInfo.usri1_priv = LMAccess.USER_PRIV_USER;
        // ignore test if not able to add user (need to be administrator to do this).
        assumeTrue(LMErr.NERR_Success == Netapi32.INSTANCE.NetUserAdd(null, 1, userInfo, null));
        try {
            IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
            IWindowsIdentity identity = prov.logonUser(userInfo.usri1_name.toString(),
                    userInfo.usri1_password.toString());
            IWindowsImpersonationContext ctx = identity.impersonate();
            assertTrue(userInfo.usri1_name.toString().equals(Advapi32Util.getUserName()));
            ctx.revertToSelf();
            assertFalse(userInfo.usri1_name.toString().equals(Advapi32Util.getUserName()));
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

        }
    }

    @Test
    public void testGetCurrentComputer() {
        IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
        IWindowsComputer computer = prov.getCurrentComputer();
        LOGGER.debug(computer.getComputerName());
        Assertions.assertThat(computer.getComputerName().length()).isGreaterThan(0);
        LOGGER.debug(computer.getJoinStatus());
        LOGGER.debug(computer.getMemberOf());
        String[] localGroups = computer.getGroups();
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

    public void testGetDomains() {
        if (Netapi32Util.getJoinStatus() != LMJoin.NETSETUP_JOIN_STATUS.NetSetupDomainName) {
            return;
        }

        IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
        IWindowsDomain[] domains = prov.getDomains();
        assertNotNull(domains);
        for (IWindowsDomain domain : domains) {
            LOGGER.debug("{}: {}", domain.getFqn(), domain.getTrustDirectionString());
        }
    }
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

            clientContext.setPrincipalName(WindowsAccountImpl.getCurrentUsername());
            clientContext.setCredentialsHandle(clientCredentials.getHandle());
            clientContext.setSecurityPackage(securityPackage);
            clientContext.initialize(null, null, targetName);
            // accept on the server
            WindowsAuthProviderImpl provider = new WindowsAuthProviderImpl();
            String connectionId = "testConnection-" + Thread.currentThread().getId();
            do {
                // accept the token on the server
                try {
                    serverContext = provider.acceptSecurityToken(connectionId, clientContext.getToken(),
                            securityPackage);
                } catch (Exception e) {
                    LOGGER.error("{}", e);
                    break;
                }
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

            clientContext.setPrincipalName(WindowsAccountImpl.getCurrentUsername());
            clientContext.setCredentialsHandle(clientCredentials.getHandle());
            clientContext.setSecurityPackage(securityPackage);
            clientContext.initialize(null, null, WindowsAccountImpl.getCurrentUsername());
            // accept on the server
            WindowsAuthProviderImpl provider = new WindowsAuthProviderImpl(1);
            int max = 100;
            for (int i = 0; i < max; i++) {
                Thread.sleep(25);
                String connectionId = "testConnection_" + i;
                serverContext = provider.acceptSecurityToken(connectionId, clientContext.getToken(), securityPackage);
                Assertions.assertThat(provider.getContinueContextsSize()).isGreaterThan(0);
            }
            LOGGER.debug("Cached security contexts: {}", Integer.valueOf(provider.getContinueContextsSize()));
            assertFalse(max == provider.getContinueContextsSize());
        } finally {
            if (serverContext != null) {
                serverContext.dispose();
            }
            if (clientContext != null) {
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

            clientContext.setPrincipalName(WindowsAccountImpl.getCurrentUsername());
            clientContext.setCredentialsHandle(clientCredentials.getHandle());
            clientContext.setSecurityPackage(securityPackage);
            clientContext.initialize(null, null, targetName);
            // accept on the server
            WindowsAuthProviderImpl provider = new WindowsAuthProviderImpl();
            String connectionId = "testConnection";
            do {
                // accept the token on the server
                try {
                    serverContext = provider.acceptSecurityToken(connectionId, clientContext.getToken(),
                            securityPackage);
                } catch (Exception e) {
                    LOGGER.error("{}", e);
                    break;
                }
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

    private static final Logger        LOGGER = LoggerFactory.getLogger(NegotiateAuthenticationRealm.class);

    private final IWindowsAuthProvider windowsAuthProvider;

    public NegotiateAuthenticationRealm() {
        this.windowsAuthProvider = new WindowsAuthProviderImpl();
    }
View Full Code Here

Examples of waffle.windows.auth.impl.WindowsAuthProviderImpl

        // waffle auth currentUser computer
        final Node node = info.getDocumentElement().getFirstChild().getFirstChild().getNextSibling();

        assertEquals("computer", node.getNodeName());

        final IWindowsAuthProvider auth = new WindowsAuthProviderImpl();
        final IWindowsComputer computer = auth.getCurrentComputer();

        final NodeList nodes = node.getChildNodes();
        assertEquals(computer.getComputerName(), nodes.item(0).getTextContent());
        assertEquals(computer.getMemberOf(), nodes.item(1).getTextContent());
        assertEquals(computer.getJoinStatus(), nodes.item(2).getTextContent());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.