diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module
index 5c5f200..f7c069b 100644
--- a/simplesamlphp_auth.module
+++ b/simplesamlphp_auth.module
@@ -405,6 +405,21 @@
 
       _simplesaml_auth_debug(t('Updating mail [%mailaddr]', array('%mailaddr' => $mail_address)));
     }
+    
+    // If user is being created by admin
+    if (user_access('administer simpleSAMLphp authentication')) {
+      if (isset($edit['simplesaml_auth']) && $edit['simplesaml_auth'] == 1) {
+        user_set_authmaps($account, array("authname_simplesamlphp_auth" => $account->name));
+  }
+}
+
+function simplesamlphp_auth_user_update(&$edit, $account, $category = NULL) {
+  if (user_access('administer simpleSAMLphp authentication')) {
+    if (isset($edit['simplesaml_auth']) && $edit['simplesaml_auth'] == 1) {
+      user_set_authmaps($account, array("authname_simplesamlphp_auth" => $account->name));
+    } else {
+      _simplesaml_auth_user_delete_authmap($account);
+    }
   }
 }
 
@@ -584,6 +599,44 @@
 }
 
 /**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function simplesamlphp_auth_form_user_register_form_alter(&$form, $form_state) {
+  if (!_simplesamlphp_auth_isEnabled()) {
+    // Exit without executing.
+    return;
+  }
+  
+  if (user_access('administer simpleSAMLphp authentication')) {
+    $form['account']['simplesaml_auth'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow login via SimpleSAML'),
+      '#description' => t('Adds an entry in the authmap table for this user.'),
+      '#default_value' => 1,
+    );
+  }
+}
+
+/**
+ * Implements hook_form_FORM_ID_alter().
+ */
+function simplesamlphp_auth_form_user_profile_form_alter(&$form, $form_state) {
+  if (!_simplesamlphp_auth_isEnabled()) {
+    // Exit without executing.
+    return;
+  }
+  
+  if (user_access('administer simpleSAMLphp authentication')) {
+    $form['account']['simplesaml_auth'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Allow login via SimpleSAML'),
+      '#description' => t('Adds an entry in the authmap table for this user.'),
+      '#default_value' => _simplesaml_auth_user_has_authmap($form['#user']->name),
+    );
+  }
+}
+
+/**
  * Implements hook_form_alter().
  */
 function simplesamlphp_auth_form_alter(&$form, $form_state, $form_id) {
