From 4379adc01421853748e2babc80b6e898c62f5691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Thu, 15 Apr 2010 14:42:17 +0000 Subject: [PATCH] SAML: reformate SP list to use EntityID as primary key --- .../lib/Lemonldap/NG/Portal/IssuerDBSAML.pm | 18 ++++++++++++++++++ .../lib/Lemonldap/NG/Portal/_SAML.pm | 5 ++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/IssuerDBSAML.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/IssuerDBSAML.pm index 7ac060ecc..91071b550 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/IssuerDBSAML.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/IssuerDBSAML.pm @@ -223,6 +223,24 @@ sub issuerForAuthUser { return PE_ERROR; } + # Get EntityID + my $entityID = $login->request->Issuer->content; + + $self->lmLog( "Request issued from $entityID", 'debug' ); + + # Find EntityID in SPList + unless ( defined $self->{_spList}->{$entityID} ) { + $self->lmLog( "$entityID do not match any known SP", 'error' ); + return PE_ERROR; + } + + $self->lmLog( + "Using SP " + . $self->{_spList}->{$entityID}->{name} + . " configuration", + 'debug' + ); + # Validate request unless ( $self->validateRequestMsg( $login, 1, 1 ) ) { $self->lmLog( "Unable to validate SSO request message", diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm index 9418eab47..b2656de86 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm @@ -244,9 +244,8 @@ sub loadSPs { my $name = $self->getOrganizationName( $self->{_lassoServer}, $entityID ) || ucfirst($_); - $self->{_spList}->{$_} = (); - $self->{_spList}->{$_}->{entityID} = $entityID; - $self->{_spList}->{$_}->{name} = $name; + $self->{_spList}->{$entityID}->{confKey} = $_; + $self->{_spList}->{$entityID}->{name} = $name; $self->lmLog( "SP $_ added", 'debug' ); }