@@ -7,7 +7,7 @@ namespace Micro.AppRegistration.Api.VerifySecret
77{
88 public interface IVerifySecretService
99 {
10- Task < bool > Verify ( string appId , string secret ) ;
10+ Task < VerifySecretResponse > Verify ( string appId , string secret ) ;
1111 }
1212 public class VerifySecretService : IVerifySecretService
1313 {
@@ -20,13 +20,21 @@ public VerifySecretService(IPasswordHasher<Application> secretHasher, IListAppli
2020 _applicationRepository = applicationRepository ;
2121 }
2222
23- public async Task < bool > Verify ( string appId , string secret )
23+ public async Task < VerifySecretResponse > Verify ( string appId , string secret )
2424 {
2525 var application = await _applicationRepository . FindById ( appId ) ;
2626 var result = _secretHasher . VerifyHashedPassword ( null , application . Secret , secret ) ;
2727 // todo: if result returns a rehash needed, we need re-hash password and save it in database.
2828 // to be done after MVP
29- return result == PasswordVerificationResult . Success || result == PasswordVerificationResult . SuccessRehashNeeded ;
29+ var success = result == PasswordVerificationResult . Success || result == PasswordVerificationResult . SuccessRehashNeeded ;
30+ return new VerifySecretResponse
31+ {
32+ Success = success ,
33+ Approved = application . Approved ,
34+ Owner = application . User ,
35+ ShortCode = application . ShortCode ,
36+ UseDefaultShortCode = application . UseDefaultCode
37+ } ;
3038 }
3139 }
3240}
0 commit comments