From 3ee1e9b393bbb4772450a9bc45f2ae9a8778b57f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Mon, 28 Jun 2010 09:11:59 +0000 Subject: [PATCH] Add an option to encode Metadata in UTF-8 (#119) --- .../lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm | 2 ++ .../lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm index d65ed6b8b..431530f05 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm @@ -378,6 +378,8 @@ sub setDefaultValues { $self->{samlIdPResolveCookie} ||= $self->{cookieName} . "idp"; $self->{samlStorage} ||= $self->{globalStorage}; $self->{samlStorageOptions} ||= $self->{globalStorageOptions}; + $self->{samlMetadataForceUTF8} = 1 + unless ( defined( $self->{samlMetadataForceUTF8} ) ); } ##@method protected void setHiddenFormValue(string fieldname, string value) 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 f941dd2f5..88e344cde 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_SAML.pm @@ -205,6 +205,10 @@ sub loadIDPs { ); } + if ( $self->{samlMetadataForceUTF8} ) { + $idp_metadata = encode( "utf8", $idp_metadata ); + } + # Add this IDP to Lasso::Server my $result = $self->addIDP( $self->{_lassoServer}, $idp_metadata ); @@ -298,6 +302,10 @@ sub loadSPs { ); } + if ( $self->{samlMetadataForceUTF8} ) { + $sp_metadata = encode( "utf8", $sp_metadata ); + } + # Add this SP to Lasso::Server my $result = $self->addSP( $self->{_lassoServer}, $sp_metadata );