Prev | 1  2  3  4  5  6  7  8  9  10  11  ... Next
dotNetInstaller 1.10 Released Draft Hidden Sticky
Read | dotnetinstaller | Sunday, July 25, 2010 8:43 PM | Post Comment | 27 Clicks

dni

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.

Waffle 1.3 Released Draft Hidden Sticky
Read | tomcat, spring, waffle, jna, active directory, win32 | Sunday, July 25, 2010 3:19 PM | Post Comment | 77 Clicks

waffleWAFFLE 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.

RemoteInstall Test Framework 1.2 Released Draft Hidden Sticky
Read | remoteinstall, testing, vmware | Saturday, July 17, 2010 12:15 PM | Post Comment | 24 Clicks
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
Single Sign-On: Spring-Security Negotiate Filter (Kerberos + NTLM) w/Waffle Draft Hidden Sticky
Read | spring, waffle, security | Friday, July 09, 2010 11:10 AM | Post Comment | 274 Clicks

springwaffle 

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.

  1. <filter>
  2.     <filter-name>springSecurityFilterChain</filter-name>
  3.     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  4. </filter>
  5. <filter-mapping>
  6.     <filter-name>springSecurityFilterChain</filter-name>
  7.     <url-pattern>/*</url-pattern>
  8. </filter-mapping>
  9. <context-param>
  10.     <param-name>contextConfigLocation</param-name>
  11.     <param-value>/WEB-INF/waffle-filter.xml</param-value>
  12. </context-param>
  13. <listener>
  14.     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  15. </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.

  1. <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.

  1. <bean id="negotiateSecurityFilterProvider" class="waffle.servlet.spi.NegotiateSecurityFilterProvider">
  2.   <constructor-arg ref="waffleWindowsAuthProvider" />
  3. </bean>
  4.  
  5. <bean id="basicSecurityFilterProvider" class="waffle.servlet.spi.BasicSecurityFilterProvider">
  6.   <constructor-arg ref="waffleWindowsAuthProvider" />
  7. </bean>
  8.  
  9. <bean id="waffleSecurityFilterProviderCollection" class="waffle.servlet.spi.SecurityFilterProviderCollection">
  10.   <constructor-arg>
  11.     <list>
  12.       <ref bean="negotiateSecurityFilterProvider" />
  13.       <ref bean="basicSecurityFilterProvider" />
  14.     </list>
  15.   </constructor-arg>
  16. </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.

  1. <bean id="basicSecurityFilterProvider" class="waffle.servlet.spi.BasicSecurityFilterProvider">
  2.   <constructor-arg ref="waffleWindowsAuthProvider" />
  3.   <property name="Realm" value="DemoRealm" />
  4. </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.

  1. <sec:http entry-point-ref="negotiateSecurityFilterEntryPoint">
  2.   <sec:intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
  3.   <sec:custom-filter ref="waffleNegotiateSecurityFilter" position="BASIC_AUTH_FILTER" />
  4. </sec:http>
  5.  
  6. <bean id="negotiateSecurityFilterEntryPoint" class="waffle.spring.NegotiateSecurityFilterEntryPoint">
  7.   <property name="Provider" ref="waffleSecurityFilterProviderCollection" />
  8. </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.

  1. <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.

  1. <bean id="waffleNegotiateSecurityFilter" class="waffle.spring.NegotiateSecurityFilter">
  2.   <property name="Provider" ref="waffleSecurityFilterProviderCollection" />
  3. </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

Iterating over lists in MSBuild Draft Hidden Sticky
Read | msbuild | Wednesday, July 07, 2010 4:33 PM | Post Comment | 33 Clicks

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.

  1. <Project DefaultTargets="all" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
  2.   <ItemGroup>
  3.     <Squirrel Include="Bob">
  4.       <Color>green</Color>
  5.       <Teeth>white</Teeth>
  6.     </Squirrel>
  7.     <Squirrel Include="Marc">
  8.       <Color>orange</Color>
  9.       <Teeth>yellow</Teeth>
  10.     </Squirrel>
  11.   </ItemGroup>
  12.   <Target Name="ShowSquirrels" Inputs="@Squirrel" Outputs="%(Squirrel.Identity)">
  13.     <Message Text="%(Squirrel.Identity) is an %(Squirrel.Color) squirrel with %(Squirrel.Teeth) teeth" />
  14.   </Target>
  15. </Project>

Run the sample above with msbuild test.proj /t:ShowSquirrels.

Introducing Oshi: Operating System and Hardware Information (Java) Draft Hidden Sticky
Read | oshi, jna, java, hardware, win32 | Tuesday, June 22, 2010 9:10 PM | Post Comment | 209 Clicks

oshi Take Hyperic SIGAR, a very popular Java API that lets you collect system information. It has two major drawbacks.

  1. It uses a native library (eg. hyperic-sigar-x86.dll), which you have to install separately from your application’s jar/war.
  2. 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.

  1. Microsoft Windows 7
  2. 2 CPU(s):
  3. Intel(R) Core(TM)2 Duo CPU T7300  @ 2.00GHz
  4. Intel(R) Core(TM)2 Duo CPU T7300  @ 2.00GHz
  5. Memory: 532.1 MB/2.0 GB

Here’s the code for the above.

  1. SystemInfo si = new SystemInfo();
  2. OperatingSystem os = si.getOperatingSystem();
  3. System.out.println(os);
  4. HardwareAbstractionLayer hal = si.getHardware();
  5. System.out.println(hal.getProcessors().length + " CPU(s):");
  6. for(Processor cpu : hal.getProcessors()) {
  7.     System.out.println(" " + cpu);
  8. }
  9. System.out.println("Memory: " +
  10.         FormatUtil.formatBytes(hal.getMemory().getAvailable()) + "/" +
  11.         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.

Code Coverage with EMMA Draft Hidden Sticky
Read | emma, waffle, testing, java | Friday, June 18, 2010 8:24 AM | Post Comment | 172 Clicks

image

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

  1. <property name="emma.dir" value="${thirdparty.dir}/emma/lib" />
  2. <path id="emma.classpath" >
  3.   <fileset dir="${thirdparty.dir}/emma/lib">
  4.     <include name="emma.jar" />
  5.     <include name="emma_ant.jar" />
  6.   </fileset>
  7. </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.

  1. <target name="instrument">
  2.   <echo message="Instrumenting ${waffle.lib}" />
  3.   <path id="build.classpath">
  4.     <pathelement path="${waffle.lib}"/>
  5.   </path>
  6.   <emma>
  7.     <instr instrpathref="build.classpath" destdir="${waffle.cover}/lib"
  8.               metadatafile="${waffle.cover}/metadata.emma" merge="true" />
  9.   </emma>
  10.   <copy todir="${waffle.lib}">
  11.     <fileset dir="${waffle.cover}/lib" includes="**/*" />
  12.   </copy>
  13. </target>

Running Tests

The tests are run the same way as before, but we need to tell Emma where to write its output.

  1. <junit ...
  2.   <jvmarg value="-Demma.coverage.out.file=${waffle.cover}/coverage.emma" />
  3. </junit>

Generating an EMMA Report

Finally, we want to get a nice HTML document that summarizes coverage.

  1. <target name="cover-report">
  2.     <emma>   
  3.         <report sourcepath="${waffle.src}">   
  4.             <fileset dir="${waffle.cover}">   
  5.                 <include name="*.emma" />   
  6.             </fileset>   
  7.             <html outfile="${waffle.cover}/coverage.html" />   
  8.         </report>   
  9.     </emma>   
  10. </target>

Here’s an output.

image

I see a lot of red. Emma doesn’t think I am doing such a great job after-all.

Links

Prev | 1  2  3  4  5  6  7  8  9  10  11  ... Next
 Highlights
Dblock.org
FoodCandy
Vestris SVN
VMWareTasks
dotNetInstaller
RemoteInstall
MSI Extensions
ResourceLib
Popular Posts
Waffle
Java Native Access (JNA)
Svn2Svn
Stuff
all posts
.net
active directory
agile
architecture
asp.net
blog
build
codeproject
databases
dos
dotnetinstaller
emma
facebook
foodcandy
google
gwt
hardware
hibernate
java
jna
jndi
jobs
log4cxx
me me
microsoft
msbuild
msi
opends
organizations
oshi
outlook
people
remoteinstall
scheme
security
sncore
soa
spring
subversion
syndication
testing
tomcat
ui
vestris
vmware
waffle
win32
wix
wmi
p | s | pop | pics | c | me | h
295870 clicks since 8/10/2008