Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Manifest Information #17

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions Source/JNA/build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<property name="waffle.test.lib" value="${waffle.root}/lib-test" />
<property name="waffle.test" value="${waffle.root}/test" />
<property name="thirdparty.dir" location="${basedir}/../../ThirdParty" />
<tstamp>
<format property="DSTAMP" pattern="yyyy-MM-dd"/>
<format property="TSTAMP" pattern="HH:mm:ss"/>
</tstamp>
<!-- compile -->
<path id="jna.classpath">
<fileset dir="${thirdparty.dir}/jna">
Expand Down Expand Up @@ -46,8 +50,13 @@
<sequential>
<delete dir="${waffle.lib}" />
<mkdir dir="${waffle.lib}" />
<javac target="${waffle.java.version}" srcdir="${waffle.src}"
destdir="${waffle.lib}" optimize="@{optimize}" debug="@{debug}"
<javac
source="${waffle.java.version}"
target="${waffle.java.version}"
srcdir="${waffle.src}"
destdir="${waffle.lib}"
optimize="@{optimize}"
debug="@{debug}"
includeantruntime="false">
<classpath refid="thirdparty.classpath" />
<classpath refid="project.classpath" />
Expand Down Expand Up @@ -143,16 +152,30 @@
<antcall target="test" />
<antcall target="cover-report" />
</target>

<target name="getgitdetails" >
<exec executable="git" outputproperty="git.revision">
<arg value="rev-parse"/>
<arg value="HEAD"/>
</exec>
</target>

<!-- package -->
<target name="jar">
<target name="jar" depends="getgitdetails">
<delete dir="${waffle.build}" />
<mkdir dir="${waffle.build}" />
<jar jarfile="${common.build}/${project.jar}.jar">
<fileset dir="${waffle.lib}">
<include name="waffle/**/*.class" />
</fileset>
<manifest>
<attribute name="Version" value="${waffle.version}" />
<attribute name="Specification-Title" value="WAFFLE - ${project.jar}" />
<attribute name="Specification-Version" value="${waffle.version}" />
<attribute name="Specification-Vendor" value="${company.name}" />
<attribute name="Implementation-Title" value="WAFFLE - ${project.jar}" />
<attribute name="Implementation-Version" value="${waffle.version} - ${user.name} - ${DSTAMP} ${TSTAMP} - ${git.revision}" />
<attribute name="Implementation-Vendor" value="${company.name}" />
<attribute name="Git-Revision" value="${git.revision}" />
<attribute name="Created-By" value="${waffle.copyright}" />
</manifest>
</jar>
Expand All @@ -161,7 +184,13 @@
<include name="waffle/**/*.java" />
</fileset>
<manifest>
<attribute name="Version" value="${waffle.version}" />
<attribute name="Specification-Title" value="WAFFLE - ${project.jar}" />
<attribute name="Specification-Version" value="${waffle.version}" />
<attribute name="Specification-Vendor" value="${company.name}" />
<attribute name="Implementation-Title" value="WAFFLE - ${project.jar}" />
<attribute name="Implementation-Version" value="${waffle.version} - ${user.name} - ${DSTAMP} ${TSTAMP} - ${git.revision}" />
<attribute name="Implementation-Vendor" value="${company.name}" />
<attribute name="Git-Revision" value="${git.revision}" />
<attribute name="Created-By" value="${waffle.copyright}" />
</manifest>
</jar>
Expand Down
105 changes: 58 additions & 47 deletions Source/JNA/demo/waffle-filter/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -1,47 +1,58 @@
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
<init-param>
<param-name>principalFormat</param-name>
<param-value>fqn</param-value>
</init-param>
<init-param>
<param-name>roleFormat</param-name>
<param-value>both</param-value>
</init-param>
<init-param>
<param-name>allowGuestLogin</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>securityFilterProviders</param-name>
<param-value>
waffle.servlet.spi.NegotiateSecurityFilterProvider
waffle.servlet.spi.BasicSecurityFilterProvider
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols</param-name>
<param-value>
Negotiate
NTLM
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.BasicSecurityFilterProvider/realm</param-name>
<param-value>WaffleFilterDemo</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
<init-param>
<param-name>principalFormat</param-name>
<param-value>fqn</param-value>
</init-param>
<init-param>
<param-name>roleFormat</param-name>
<param-value>both</param-value>
</init-param>
<init-param>
<param-name>allowGuestLogin</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>securityFilterProviders</param-name>
<param-value>
waffle.servlet.spi.NegotiateSecurityFilterProvider
waffle.servlet.spi.BasicSecurityFilterProvider
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols</param-name>
<param-value>
Negotiate
NTLM
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.BasicSecurityFilterProvider/realm</param-name>
<param-value>WaffleFilterDemo</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- System Information Helpful for debugging -->
<servlet>
<servlet-name>WaffleInfo</servlet-name>
<servlet-class>waffle.servlet.WaffleInfoServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WaffleInfo</servlet-name>
<url-pattern>/waffle</url-pattern>
</servlet-mapping>

</web-app>
74 changes: 37 additions & 37 deletions Source/JNA/waffle-core/src-test/waffle/util/AllUtilTests.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
/*******************************************************************************
* Waffle (https://github.com/dblock/waffle)
*
* Copyright (c) 2010 Application Security, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Application Security, Inc.
*******************************************************************************/
package waffle.util;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({ Base64Tests.class, NtlmMessageTests.class })
public class AllUtilTests {

@BeforeClass
public static void setUpClass() {
System.out.println("Master Util setup");

}

@AfterClass
public static void tearDownClass() {
System.out.println("Master Util tearDown");
}

}
/*******************************************************************************
* Waffle (https://github.com/dblock/waffle)
*
* Copyright (c) 2010 Application Security, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Application Security, Inc.
*******************************************************************************/
package waffle.util;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({ Base64Tests.class, NtlmMessageTests.class, WaffleInfoTests.class })
public class AllUtilTests {
@BeforeClass
public static void setUpClass() {
System.out.println("Master Util setup");
}
@AfterClass
public static void tearDownClass() {
System.out.println("Master Util tearDown");
}
}
47 changes: 47 additions & 0 deletions Source/JNA/waffle-core/src-test/waffle/util/WaffleInfoTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*******************************************************************************
* Waffle (https://github.com/dblock/waffle)
*
* Copyright (c) 2010 Application Security, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Application Security, Inc.
*******************************************************************************/
package waffle.util;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import waffle.windows.auth.IWindowsAuthProvider;
import waffle.windows.auth.IWindowsComputer;
import waffle.windows.auth.impl.WindowsAuthProviderImpl;

import junit.framework.TestCase;

/**
*/
public class WaffleInfoTests extends TestCase {
public void testWaffleInfo() throws Exception {
Document info = new WaffleInfo().getSystemInfo();

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

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

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

NodeList nodes = elem.getChildNodes();
assertEquals(computer.getComputerName(), nodes.item(0).getTextContent());
assertEquals(computer.getMemberOf(), nodes.item(1).getTextContent());
assertEquals(computer.getJoinStatus(), nodes.item(2).getTextContent());
}
}
Loading