Git Product home page Git Product logo

je.identityserver.security's Introduction

JE.IdentityServer.Security

An OWIN Middleware component for an OpenIdConnect endpoint that provides the following a set of security features

Build status

Currently targets IdentityServer3 v2.

TL;DR

Features

A set of OWIN middleware components providing the following features:

  • Google Recaptcha for OpenIdConnect

  • Throttling for logins

Throttling for OpenIdConnect native logins

In order to register the middleware for throttling, you should register your implementation of ILoginStatistics with your IoC container (see below) and inject this into the middleware as a factory lambda method. Your implementation of ILoginStatistics must implement IDisposable and the lifetime of this object will be managed per OWIN request.

app.UsePerOwinContext<ILoginStatistics>(() => new ImplementationOfLoginStatistics());

app.UseThrottlingForAuthenticationRequests(new IdentityServerThrottlingOptions
{
    ProtectedPath = "/identity/connect/token",
    NumberOfAllowedLoginFailures = 3,
    ExcludedUsernameExpressions = _excludedUsernameExpressions,
    ProtectedGrantTypes = new string[] { "password" },
});

// Register IdentityServer
app.Map("/identity", idsrvApp => idsrvApp.UseIdentityServer(IdentityServerBootstrap.CreateStartupOptions()));

IdentityServerThrottlingOptions is used to configure the middleware on bootstrap and provides the following parameters:

Parameter Default Description
ProtectedPath /identity/connnect/token Path to protect
NumberOfAllowedLoginFailures 0 Number of allowed login failures before throttling requests
ExcludedUsernameExpressions empty list A list of regexes that allows you to skip throttling and reporting for specific email addresses eg load testing accounts
ProtectedGrantTypes empty list A list of protected grant types that should be throttled eg native vs social login

Injecting your own services with your favourite container

var middlewareOptions = new IdentityServerThrottlingOptions
{
// some options
};

var container = new MyContainer();  // eg. StructureMap in this case
appBuilder.UsePerOwinContext(() => container.GetInstance<ILoginStatistics>());

appBuilder.UseThrottlingForAuthenticationRequests(middlewareOptions);

How to contribute

See CONTRIBUTING.md.

How to release

See CONTRIBUTING.md.

je.identityserver.security's People

Contributors

jonnywidefoot avatar rajwilkhu avatar adammorr avatar hjgraca avatar timvw74 avatar josephwoodward avatar petemounce avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.