RainLoop / rainloop-webmail

Simple, modern & fast web-based email client
http://rainloop.net
MIT License
4.12k stars 893 forks source link

SSO with hashed Password #1423

Open bylmzio opened 7 years ago

bylmzio commented 7 years ago

Hi, is it possible , not to use the plain Password, instead of using hashed password. I want to store that password hashed in a Database. So if a logged in User clicks the Login Button he will redirected to rainloop.

<?php
define('RAINLOOP_INCLUDE_AS_API', true);
include '/var/www/rainloop/index.php';
$myHashedPW=$_POST['hashed_PW'];
$ssoHash = \RainLoop\Api::GetUserSsoHash('user@yourdomain.com', $myHashedPW);
\header('Location: http://yourdomain.com/rainloop/?sso&hash='.$ssoHash);
bilel commented 1 year ago

It's Possible but not that way. Because the api here expects a plain password. Unless you are asking Rainloop Team for a new hashing feature..

Otherwise, you can define your encryption and decryption functions You can choose openssl_encrypt / openssl_decrypt with a private key for example

When you store the password in the database, you use the encrypt function When you request it later from the DB, you use the decrypt function

then it would look like this : $myHashedPW=MyDecryptFunction($_POST['hashed_PW'],$myKey);