coolOrangeLabs / powerGateTemplate

powerGate full functional sample ERP integration
MIT License
3 stars 3 forks source link

Save ERP Credenials in Vault Options #138

Open PatrickGrub opened 4 years ago

PatrickGrub commented 4 years ago

Details

The dummy plugin uses no credentials at the moment to communicate afterward with the ERP.

UseCase

Example for plugin read credentials

Extend powerGateServer config:

<behaviors>
      <serviceBehaviors>
        <behavior>
          <log4net />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
               customUserNamePasswordValidatorType="WCF_UserAuthentication.UserAuthentication, WCF_UserAuthentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/> 
          </serviceCredentials> 
        </behavior>
      </serviceBehaviors>
</behaviors>

Im Plugin ist es zu erweitern, das wird für jeden Service verwendet:

using System;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;

namespace WCF_UserAuthentication
{
  public class UserAuthentication : UserNamePasswordValidator
  {
    public override void Validate(string userName, string password)
    {
      if (userName == null || null == password)
        throw new ArgumentNullException();
      if (!(userName == "coolOrange") || !(password == "coo!Orange"))
        throw new SecurityTokenException("Unknown Username or Password");
    }
  }
}
manfredmalleier commented 4 years ago

Functionality implemented in Metso #157:

PatrickGrub commented 2 years ago

@kevinhallerCO this issue should be planned on my site since its very powerful and flexible for endcustomers, it will take about 4 hours.

kevinhallerCO commented 2 years ago

@PatrickGrub planned for the 28th. January for now (if there should be more urgent matters, we'll re-schedual this issue)