protected GoodIdEndpoint(
            IncomingRequest incomingRequest,
            string clientId,
            RsaPrivateKey signingKey,
            RsaPrivateKey encryptionKey,
            OpenIdRequestSource requestSource,
            string redirectUri,
            Acr acr,
            int?maxAge,
            ServiceLocator serviceLocator)
        {
            if (string.IsNullOrEmpty(clientId))
            {
                throw new GoodIdException($"{nameof(clientId)} can not be empty");
            }

            if (maxAge.HasValue && (maxAge.Value < MAX_AGE_MIN_VALUE || maxAge.Value > MAX_AGE_MAX_VALUE))
            {
                throw new GoodIdException($"{nameof(maxAge)} must be null or an int in the range [{MAX_AGE_MIN_VALUE}, {MAX_AGE_MAX_VALUE}]");
            }

            mIncomingRequest = incomingRequest;
            mClientId        = clientId;
            mSigningKey      = signingKey;
            mEncryptionKey   = encryptionKey;
            mRequestSource   = requestSource;
            mRedirectUri     = redirectUri;
            mAcr             = acr;
            mMaxAge          = maxAge;
            mServiceLocator  = serviceLocator;
        }
Esempio n. 2
0
        public static GoodIdEndpoint CreateGoodIDEndpoint(
            ServiceLocator serviceLocator,
            IncomingRequest incomingRequest,
            string clientId,
            RsaPrivateKey signingKey,
            RsaPrivateKey encryptionKey,
            OpenIdRequestSource openIdRequestSource,
            string redirectUri,
            Acr acr    = Acr.LEVEL_DEFAULT,
            int?maxAge = null
            )
        {
            try
            {
                var goodIdServerConfig = serviceLocator.ServerConfig;

                var sessionDataHandler = serviceLocator.SessionDataHandler;
                var stateNonceHandler  = serviceLocator.StateNonceHandler;


                return(new GoodIdRequestBuilderEndpoint(
                           incomingRequest,
                           clientId,
                           signingKey,
                           encryptionKey,
                           openIdRequestSource,
                           redirectUri,
                           acr,
                           maxAge,
                           serviceLocator
                           ));
            }catch (GoodIdException) {
                throw;
            }
            catch (Exception e) {
                throw new GoodIdException("Unknown error: " + e.Message);
            }
        }
 internal GoodIdRequestBuilderEndpoint(
     IncomingRequest incomingRequest,
     string clientId,
     RsaPrivateKey signingKey,
     RsaPrivateKey encryptionKey,
     OpenIdRequestSource requestSource,
     string redirectUri,
     Acr acr,
     int?maxAge,
     ServiceLocator serviceLocator
     )
     : base(
         incomingRequest,
         clientId,
         signingKey,
         encryptionKey,
         requestSource,
         redirectUri,
         acr,
         maxAge,
         serviceLocator
         )
 {
 }