diff --git a/Security/ShibbolethAuthProvider.php b/Security/ShibbolethAuthProvider.php
index <HASH>..<HASH> 100644
--- a/Security/ShibbolethAuthProvider.php
+++ b/Security/ShibbolethAuthProvider.php
@@ -90,8 +90,14 @@ class ShibbolethAuthProvider implements AuthenticationProviderInterface {
 
 	public function retrieveUser($token) {
 		try {
-			$user = $this->userProvider
-					->loadUser($token);
+                        if ($this->userProvider instanceof ShibbolethUserProviderInterface) {
+                            $user = $this->userProvider
+                                            ->loadUser($token);
+                        } else {
+                            $user = $this->userProvider
+                                            ->loadUserByUsername($token);
+                        }
+                        
 			if (null !== $this->logger)
 				$this->logger
 						->debug(
Safety check
Make sure user provider implements ShibbolethUserProviderInterface before using loadUser($token) method.
Fallback to loadUserByUsername($username) otherwise