Perl script to figure out change in service schema

As we have already shipped OpenSSO Enterprise 8.0; and we are working on the next official release, service schema XML files are likely to change (upgrade). Here is the PERL script that finds them.

Remember to set the values of $EIGHT_DOT_ZERO and $CURRENT

#!/usr/bin/perl -w

use strict;

my $EIGHT_DOT_ZERO = '/home/dennis/workspace/opensso8.0';
my $CURRENT = '/home/dennis/workspace/opensso1';

my %eightdotXMLs;
my %currentXMLs;

getServiceXMLs(
    "$EIGHT_DOT_ZERO/opensso/products/amserver/xml/services",
     \%eightdotXMLs);
getServiceXMLs(
    "$EIGHT_DOT_ZERO/opensso/products/federation/openfm/xml/services",
    \%eightdotXMLs);
getServiceXMLs(
    "$CURRENT/opensso/products/amserver/xml/services",
     \%currentXMLs);
getServiceXMLs(
    "$CURRENT/opensso/products/federation/openfm/xml/services",
     \%currentXMLs);

foreach (keys %currentXMLs) {
    my $name = $_;
    my $rev = $currentXMLs{$_};
    
    if (! defined $eightdotXMLs{$name}) {
        print "$name ($rev) \n";
        }
    }
}

sub getServiceXMLs {
    my $base = shift;
    my $hash = shift;
    opendir(DIR, $base);
    foreach (readdir DIR) {
        my $f = $_;
        if (($f !~ /^\./) && ($f =~ /\.xml$/)) {
            getRev("$base/$f", $hash);
        }
    }
    closedir DIR;
}

sub getRev {
    my $file = shift;
    my $hash = shift;
    my $f = $file;
    $f =~ s/.+\///;
    
    my $buff = '';
    
    open(FILE, $file);
    while () {
        chomp;
        $buff .= $_;
    }
    close FILE;
    if ($buff =~ /<Schema .+?revisionNumber="(.+?)"/) {
        ${%{$hash}}{$f} = $1;       
    } else {
        ${%{$hash}}{$f} = 0;
    }
}
 
Advertisements

Clean Code

I was at Borders on Saturday and was reading Clean Code by Uncle Bob. It mentioned that quality of code is measured by WTF/minute. Look at this Cartoon to understand what he meant. 🙂

Many of us have encountered this before. i.e. looking at a piece of code and go WTF, WTF, WTF …. It is very difficult to review code in cases like this. Comments were lacking or missing; methods were over 100 lines long (btw, the suggested length of a method is 24); and code was not well indented.

This book is very easy to read because many of the things written in it were common sense. For instance, “bad code functions too”; bad code causes organizational loss because of defects and difficulty in maintaining it (now why people are ignoring this?); have small classes and methods; etc.

Uncle Bob has done a good job in writing this book. Do get a copy of it if you are a software developer AND want to write clean code 🙂

OpenSSO Diagnostic Tool

From the creator of OpenSSO Diagnostic Tool

We have developed an initial version of Diagnostic Tool to assist in identifying possible OpenSSO configuration issues. The current Beta version is bundled inside ssoExternalTools.zip and is available under the nightly builds for download. Even though this Beta version is not officially supported as yet, any comments/suggestions/issues are welcome to assist in enhancing the tool.

Download location : here
Documentation: here

Example on how to get Group attributes from REST

<html>

<body>
<form action="http://www.example.com:8080/opensso/identity/read" >
<input name="name"  value="group1"/>
<input name="attributes_names"  value="objecttype"/>
<input name="attributes_names"  value="realm"/>
<input name="attributes_values_objecttype"  value="Group"/>
<input name="attributes_values_realm"  value="/"/>
<input name="admin" 
value="AQIC5wM2LY4SfcwHRXo4oE+yuHQ0BPQD+GZ1/Qd5tCzO9X8=@AAJTSQACMDE=#" />
<input type="submit" />
</form>
</body>
</html>

OpenSSO on Glassfish v3 Prelude

You will run into issue when you deploy opensso.war on
Glassfish v3 prelude (I think even Sun Web Server 7 update 3)

After you have successfully login to console, the request
is redirected back to the Login page.

Several people have already reported this problem.

Here is what happen. OpenSSO sets a cookie with value containing “=”. and Glassfish truncates the cookie value. Since OpenSSO server cannot get the entire cookie value, SSO Token cannot be created.

An issue is filed on Glassfish.

AT&T Service Support

Today (Saturday) at about 10 PM, my phone line and DSL were down. My wife called AT&T support guys. The call was transfered several times and she waited for about 15 minutes before a human talked to her. The guy said that one of our phones was jamming the line. He suggested we plug all the phones, wait for 5-10 minutes, plug in one of the phones and test the line again. My wife got off the phone and did what she was told to do. But, the problem still persisted.

We were thinking that we would not internet connection for the entire weekend. 😦

On our way to a Japanese supermarket, my wife called AT&T to dispatch a technician to fix the problem on Monday.

At about 3PM, my cell phone rang, it was from AT&T. The technical said that he was in our neighborhood and could stop by to fix the line. What a delight!

He came and found that one of our phone lines was short-circuited. We need to pay AT&T to get it fix as the problem is with a wire running in the house. However, he said that no charges would be made if the wire can be easily rectified. Luck is on our side, he fixed the problem, left us his name card and thanked us for using AT&T.

We are really impressed with the service provided. Will stick with AT&T!

I have my internet connection back and able to blog about it 🙂