|
Read
| dotnetinstaller
| Sunday, July 25, 2010 8:43 PM
| 27 Clicks
|
Edit
| Delete
dotNetInstaller 1.10 was released July 12th, 2010. dotNetInstaller is a very popular general purpose setup bootstrapper for Microsoft Windows created by Davide Icardi. I’ve been maintaining the project and contributing the vast majority of the features since 2008, mostly driven by our needs at work. > Download Here’re some highlights in this release. - Added support for executable components with an optional response file and installation directory.
- Added lots of convenience features in Installer Editor, such as remembering configuration files.
- Added os_filter that behaves like lcid_filter for operating system IDs.
- Added user-defined image control.
- Holding the keyboard Control key and double-clicking on a bootstrapper component will install it, regardless of whether the component is selected or not.
- Added /ProcessorArchitecture:list to InstallerLinker to link an installer targeting a specific platform architecture.
The next release (2.0) should be very exciting as I’ve been prototyping an HTML-based installer that gives users full control of the bootstrapper UI. Stay tuned.
|
Read
| tomcat, spring, waffle, jna, active directory, win32
| Sunday, July 25, 2010 3:19 PM
| 77 Clicks
|
Edit
| Delete
WAFFLE exposes native Windows authentication facilities to C# and Java clients using JNA. Version 1.3 has shipped Wednesday, July 21, 2010. WAFFLE has seen incredible interest and production adoption in the last few months as I’ve coded a bunch of Java filters > Download 1.3. - If you’re writing PInvoke in C# or Java code for Windows authentication, save yourself some time, WAFFLE has these features for you:
- Account lookup locally and in Active Directory via Win32 API with zero configuration.
- Enumerating Active Directory domains and domain information.
- Returns computer domain / workgroup join information.
- Supports logon for local and domain users returning consistent fully qualified names, identity (SIDs), local and domain groups, including nested.
- Supports all functions required for implementing server-side single-signon with Negotiate and NTLM.
- Supports Windows Identity impersonation.
- Includes a Windows Installer Merge Module for distribution of C# binaries.
- If you're using Tomcat or Jetty with an IIS front-end to do authentication only, Waffle has the following features and will allow you to get rid of IIS:
- A Tomcat Negotiate (NTLM and Kerberos) Authenticator Valve - Tutorial.
- A generic Servlet Negotiate (NTLM and Kerberos) Security Filter - Tutorial.
- A Tomcat Single Sign-On + Form Authentication Mixed Valve - Tutorial.
- A Spring-Security Negotiate (NTLM and Kerberos) Filter - Totorial.
- A Spring-Security Windows Authentication Manager.
- A JAAS Login Module - Tutorial.
WAFFLE has originated at AppSecInc. and the team deserves the credit. John has a blog too, check it out.
|
Read
| remoteinstall, testing, vmware
| Saturday, July 17, 2010 12:15 PM
| 24 Clicks
|
Edit
| Delete
I’ve released the RemoteInstaller Test Framework 1.2. It’s the second open-source release (click here for an intro) and I am pleased to see some community adoption. RemoteInstall is a system for automated testing based on VMWare technology and makes it easy to install software and execute tests against it.
The most important features in 1.2 include support for user-defined exit codes, support for rebooting between installers and passing snapshot-specific parameters around.
> Download
|
Read
| spring, waffle, security
| Friday, July 09, 2010 11:10 AM
| 274 Clicks
|
Edit
| Delete
In this post I’ll explain how to configure the Waffle Spring-Security Negotiate filter to do single-sign-on on Windows and touch on how much more elegant the spring-based filter configuration is versus, for example, the generic servlet filter. Download Download Waffle 1.3. The zip contains Waffle.chm with the latest version of this tutorial. Configure Your Application Configure Spring-Security We'll assume that Spring-Security is configured via web.xml with a filter chain and a Spring ContextLoaderListener. The Waffle beans configuration will be added to waffle-filter.xml. - <filter>
- <filter-name>springSecurityFilterChain</filter-name>
- <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>springSecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>/WEB-INF/waffle-filter.xml</param-value>
- </context-param>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
Package Files You need waffle-jna.jar, jna.jar, platform.jar and commons-logging-1.1.1.jar from the Waffle distribution as well as Spring and Spring-security JARs. Those should be placed in your application’s classpath (eg. packaged in WAR). If you’re using Tomcat, for demo purposes you can put these files in Tomcat’s lib. Windows Authentication Provider Declare a Windows Authentication provider. This is the link between Waffle and the operating system. - <bean id="waffleWindowsAuthProvider" class="waffle.windows.auth.impl.WindowsAuthProviderImpl" />
Waffle Security Filter Providers Declare a collection of Waffle security filter providers that implement various authentication protocols. - <bean id="negotiateSecurityFilterProvider" class="waffle.servlet.spi.NegotiateSecurityFilterProvider">
- <constructor-arg ref="waffleWindowsAuthProvider" />
- </bean>
-
- <bean id="basicSecurityFilterProvider" class="waffle.servlet.spi.BasicSecurityFilterProvider">
- <constructor-arg ref="waffleWindowsAuthProvider" />
- </bean>
-
- <bean id="waffleSecurityFilterProviderCollection" class="waffle.servlet.spi.SecurityFilterProviderCollection">
- <constructor-arg>
- <list>
- <ref bean="negotiateSecurityFilterProvider" />
- <ref bean="basicSecurityFilterProvider" />
- </list>
- </constructor-arg>
- </bean>
If you’re not very familiar with Spring, you will start loving it right here. We’re adding two providers to a collection in a configuration file. This means that we don’t need to have another configuration mechanism than this one to add or remove one. We don’t need to do this in code either. Each class instance (bean) is also configurable individually – we can, for example, configure the name of the realm for Basic authentication. - <bean id="basicSecurityFilterProvider" class="waffle.servlet.spi.BasicSecurityFilterProvider">
- <constructor-arg ref="waffleWindowsAuthProvider" />
- <property name="Realm" value="DemoRealm" />
- </bean>
It’s more verbose, but it’s much more flexible. Add a Waffle Security Filter Add the Waffle security filter and entry point to the sec:http configuration section. The filter will be placed before the Basic authentication filter that ships with Spring-Security. The filter uses the collection of authentication filter providers defined above to perform authentication. - <sec:http entry-point-ref="negotiateSecurityFilterEntryPoint">
- <sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
- <sec:custom-filter ref="waffleNegotiateSecurityFilter" position="BASIC_AUTH_FILTER" />
- </sec:http>
-
- <bean id="negotiateSecurityFilterEntryPoint" class="waffle.spring.NegotiateSecurityFilterEntryPoint">
- <property name="Provider" ref="waffleSecurityFilterProviderCollection" />
- </bean>
Spring-Security Authentication Manager Define a required default Spring-Security authentication manager. We’re not going to use it in this setup because the filter takes care of authentication and the user doesn’t have a way to supply, for example, a username and password. - <sec:authentication-manager alias="authenticationProvider" />
Note that Waffle does include a Spring-based authentication manager for form-based authentication or non-web-based scenarios. The Filter Itself Finally, define the Spring-Security Waffle filter that uses the collection of security filter providers to perform authentication. - <bean id="waffleNegotiateSecurityFilter" class="waffle.spring.NegotiateSecurityFilter">
- <property name="Provider" ref="waffleSecurityFilterProviderCollection" />
- </bean>
Demo Application A demo application with the complete configuration file can be found in the Waffle distribution in the Samples\waffle-spring-filter directory. Copy the entire directory into Tomcat's webapps directory and navigate to http://localhost:8080/waffle-spring-filter/. You should be automatically logged-in under your current Windows account. You can also see/browse the configuration source code here. Links
|
Read
| msbuild
| Wednesday, July 07, 2010 4:33 PM
| 33 Clicks
|
Edit
| Delete
I never remember how to do this, so here’s a refresher. In MSBuild you can easily define a list with properties and iterate over it. - <Project DefaultTargets="all" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
- <ItemGroup>
- <Squirrel Include="Bob">
- <Color>green</Color>
- <Teeth>white</Teeth>
- </Squirrel>
- <Squirrel Include="Marc">
- <Color>orange</Color>
- <Teeth>yellow</Teeth>
- </Squirrel>
- </ItemGroup>
- <Target Name="ShowSquirrels" Inputs="@Squirrel" Outputs="%(Squirrel.Identity)">
- <Message Text="%(Squirrel.Identity) is an %(Squirrel.Color) squirrel with %(Squirrel.Teeth) teeth" />
- </Target>
- </Project>
Run the sample above with msbuild test.proj /t:ShowSquirrels.
|
Read
| oshi, jna, java, hardware, win32
| Tuesday, June 22, 2010 9:10 PM
| 209 Clicks
|
Edit
| Delete
Take Hyperic SIGAR, a very popular Java API that lets you collect system information. It has two major drawbacks. - It uses a native library (eg. hyperic-sigar-x86.dll), which you have to install separately from your application’s jar/war.
- It’s GPL v2. My legal department immediate flagged that as a no-go since we’re a commercial product.
Sounds like we could live with the first problem, but we can’t live with the second. Licensing is a pest. While we’re at it, we should be able to leverage JNA and fix the first problem too. In the end we could end up with a very nice library that lots of people use. Oshi Project Introducing the Oshi Project. I’ve put a day of work into it and a bit of design thought in terms of operating system and hardware interfaces. I’ve implemented those for Windows, so it can generate this kind of output. - Microsoft Windows 7
- 2 CPU(s):
- Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
- Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
- Memory: 532.1 MB/2.0 GB
Here’s the code for the above. - SystemInfo si = new SystemInfo();
- OperatingSystem os = si.getOperatingSystem();
- System.out.println(os);
- HardwareAbstractionLayer hal = si.getHardware();
- System.out.println(hal.getProcessors().length + " CPU(s):");
- for(Processor cpu : hal.getProcessors()) {
- System.out.println(" " + cpu);
- }
- System.out.println("Memory: " +
- FormatUtil.formatBytes(hal.getMemory().getAvailable()) + "/" +
- FormatUtil.formatBytes(hal.getMemory().getTotal()));
What’s Next? Give Oshi a try, http://oshi.codeplex.com/. Oshi needs your help to implement *nix ports and create interfaces for other types of software and hardware information, such as disks, processes, printers, etc. Some of the functionality may be generic and should be pushed into JNA.
|
Read
| emma, waffle, testing, java
| Friday, June 18, 2010 8:24 AM
| 172 Clicks
|
Edit
| Delete
I’ve written an unusually high number of unit tests for the Java portion of Waffle, mostly because the project became popular really fast with all those Java people trying to do Windows authentication. Some have succeeded and some filed several rather complicated bug reports that dealt with concurrency, sessions across HTTP requests, etc. It all needed to be unit-tested in order to make industrial-grade software. If you asked me yesterday, I would have said that Waffle unit tests cover 99% of the code. But Emma says otherwise, and it’s probably right. Running Emma with JUnit It took me half an hour to integrate Emma. Pretty easy. You should do it too. I downloaded Emma from http://emma.sourceforge.net and added it to ThirdParty/emma. What I want next is a cover target that can execute all unit tests with code coverage. We’re doing this in ANT with JUnit. Define Emma JARs Location and ClassPath - <property name="emma.dir" value="${thirdparty.dir}/emma/lib" />
- <path id="emma.classpath" >
- <fileset dir="${thirdparty.dir}/emma/lib">
- <include name="emma.jar" />
- <include name="emma_ant.jar" />
- </fileset>
- </path>
Instrument Files I went the route of not changing my build tasks and instrumenting the .class files already built. Then I swap in those files with the instrumented ones. Note that Emma only generates .class files for instrumentable classes – those not containing debugging information, interface definitions and such aren’t included. - <target name="instrument">
- <echo message="Instrumenting ${waffle.lib}" />
- <path id="build.classpath">
- <pathelement path="${waffle.lib}"/>
- </path>
- <emma>
- <instr instrpathref="build.classpath" destdir="${waffle.cover}/lib"
- metadatafile="${waffle.cover}/metadata.emma" merge="true" />
- </emma>
- <copy todir="${waffle.lib}">
- <fileset dir="${waffle.cover}/lib" includes="**/*" />
- </copy>
- </target>
Running Tests The tests are run the same way as before, but we need to tell Emma where to write its output. - <junit ...
- <jvmarg value="-Demma.coverage.out.file=${waffle.cover}/coverage.emma" />
- </junit>
Generating an EMMA Report Finally, we want to get a nice HTML document that summarizes coverage. - <target name="cover-report">
- <emma>
- <report sourcepath="${waffle.src}">
- <fileset dir="${waffle.cover}">
- <include name="*.emma" />
- </fileset>
- <html outfile="${waffle.cover}/coverage.html" />
- </report>
- </emma>
- </target>
Here’s an output.  I see a lot of red. Emma doesn’t think I am doing such a great job after-all. Links
|
|
295870 clicks since 8/10/2008
|