@@ -76,8 +76,8 @@ func (c *authorizationComponentMW) GetUserByUsernameInSocialRealm(ctx context.Co
7676 var action = KYCGetUserByUsernameInSocialRealm .String ()
7777
7878 // For this method, there is no target realm provided
79- // as parameter, so we pick the configured social realm.
80- var targetRealm = c . realmName
79+ // as parameter, so we pick the current realm of the user .
80+ var targetRealm = ctx . Value ( cs . CtContextRealm ).( string )
8181
8282 if err := c .authManager .CheckAuthorizationOnTargetRealm (ctx , action , targetRealm ); err != nil {
8383 return apikyc.UserRepresentation {}, err
@@ -90,8 +90,8 @@ func (c *authorizationComponentMW) GetUserInSocialRealm(ctx context.Context, use
9090 var action = KYCGetUserInSocialRealm .String ()
9191
9292 // For this method, there is no target realm provided
93- // as parameter, so we pick the configured social realm.
94- var targetRealm = c . realmName
93+ // as parameter, so we pick the current realm of the user .
94+ var targetRealm = ctx . Value ( cs . CtContextRealm ).( string )
9595
9696 if err := c .authManager .CheckAuthorizationOnTargetRealm (ctx , action , targetRealm ); err != nil {
9797 return apikyc.UserRepresentation {}, err
@@ -104,8 +104,8 @@ func (c *authorizationComponentMW) ValidateUserInSocialRealm(ctx context.Context
104104 var action = KYCValidateUserInSocialRealm .String ()
105105
106106 // For this method, there is no target realm provided
107- // as parameter, so we pick the configured social realm.
108- var targetRealm = c . realmName
107+ // as parameter, so we pick the current realm of the user .
108+ var targetRealm = ctx . Value ( cs . CtContextRealm ).( string )
109109
110110 if err := c .authManager .CheckAuthorizationOnTargetRealm (ctx , action , targetRealm ); err != nil {
111111 return err
0 commit comments