Monday, July 25, 2011

Groovy.... Creating an XML file

import groovy.xml.MarkupBuilder
def valuefile = new File('TestData.xml')
def writer = new StringWriter()
def xml = new MarkupBuilder(writer)
Random random = new Random()
xml.records() {
for(int i=1; i<= 200; i++){ items{ id(i) orderId((1000+i)) price(random.nextInt(1000)+0.99) productId(random.nextInt(44)+1+'-' +(random.nextInt(999)+1)) productName('Appliances') quantity(random.nextInt(3)+1) shippingAddress('Some address') shippingCity('Some city') shippingName('UPS') shippingPhoneNumber('123456789') shippingState('PA') shippingZip('12345') } } } valuefile.append writer.toString() println writer.toString()

Monday, May 30, 2011

Spring security Kerberos Integration

Spring Security Kerberos Extension, authenticated the users against web application just by opening the URL. There is no need to enter a username/password and no need to install additional software.

To enable this integration we need the following steps,

1- Create a user in the active directory
i. server1
Set up the user password policy to non-expiring password

2- Create SPN for the user (Step 1- user)
The following command has to run to create spn for the above user
i. setspn –a username
ii. setspn -a HTTP/server1.domain.com@DOMAIN.COM server1

3- Create Key tab file
The following command has to run to create key tab file.
i. ktpass /out /mapuser /princ -kvno 0 /pass /ptype KRB5_NT_PRINCIPAL
ii. ktpass /out name.keytab /mapuser server1@domain.com /princ HTTP/server1.domain.com@DOMAIN.COM -kvno 0 /pass password /ptype KRB5_NT_PRINCIPAL

For spring configuration and more information please refer the following url

http://blog.springsource.com/2009/09/28/spring-security-kerberos/