diff --git a/openid_provider.inc b/openid_provider.inc
index 064bc54..84ca896 100644
--- a/openid_provider.inc
+++ b/openid_provider.inc
@@ -157,7 +157,16 @@ function openid_provider_authentication_response($request) {
   $response = array_merge($response, module_invoke_all('openid_provider', 'response', $response, $request));
 
   $rp = _openid_provider_rp_load($user->uid, $realm);
-  if ($rp->auto_release) {
+  $whitelist = explode("\r\n", variable_get('openid_provider_whitelist', ""));
+  $blacklist = explode("\r\n", variable_get('openid_provider_blacklist', ""));
+  $whitelist_only = variable_get('openid_provider_whitelist_only', FALSE);
+  if (($whitelist_only and !in_array($realm, $whitelist)) or in_array($realm, $blacklist)) {
+    // If realm on blacklist, or whitelist_only, cancle the login request.
+    unset($_POST);
+    header('Location: '. $response['openid.return_to'], TRUE, 302);
+    exit;
+  }
+  elseif ($rp->auto_release or in_array($realm, $whitelist)) {
     $response = _openid_provider_sign($response);
     _openid_provider_rp_save($user->uid, $realm, TRUE);
     _openid_provider_debug('automatic response authentication success using 1.0 redirect to %url (response dump: <pre>%response</pre>)', array('%url' => $request['openid.return_to'], '%response' => var_export($response, TRUE)));
diff --git a/openid_provider.module b/openid_provider.module
index 8fe42ec..2d91fe1 100644
--- a/openid_provider.module
+++ b/openid_provider.module
@@ -185,6 +185,30 @@ function openid_provider_admin_settings() {
     '#description' => t('This will enable debugging of this module to the watchdog.'),
     '#default_value' => variable_get('openid_provider_debugging', false),
   );
+  $form['sitelist'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Sites management'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+  $form['sitelist']['openid_provider_whitelist'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Whitelist'),
+    '#default_value' => variable_get('openid_provider_whitelist', ""),
+    '#description' => t('Sites on this list will be automaticcally logged in through the OpenID provider without confirmation page. Please fill in full site name e.g. <em>http://www.example.com/</em>'),
+  );
+  $form['sitelist']['openid_provider_whitelist_only'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Disable anonymouse site'),
+    '#default_value' => variable_get('openid_provider_whitelist_only', FALSE),
+    '#description' => t('Only allow sites on the whitelist to login using the OpenID provider.'),
+  );
+  $form['sitelist']['openid_provider_blacklist'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Blacklist'),
+    '#default_value' => variable_get('openid_provider_blacklist', ""),
+    '#description' => t('Sites on this list will be completely forbidden to login through the OpenID provider.'),
+  );
   return system_settings_form($form);
 }
 
