Code Monkey home page Code Monkey logo

d2l.security.oauth2's Introduction

D2L.Security.OAuth2

.NET libraries for integrating with Brightspace OAuth 2.0. These libraries implement D2L-specific functionality (like validating access tokens, manipulating scope, etc.) and the jwt-bearer grant. Most third-party users should use a cross-platform OAuth 2.0 library of their choosing (see the "Client Libraries" section on this page for examples.)

Libraries

The libraries in this repository are published in lock-step. It is recommended that you maintain a consistent version number on any of these that you depend on. Mixing versions as of the version 5.0 release is not supported.

D2L.Security.OAuth2

NuGet

Core functionality for request validation and token provisioning.

D2L.Security.OAuth2.WebApi

NuGet

WebAPI integration in the form of filters/attributes/etc.

D2L.Security.OAuth2.TestFramework

NuGet

Helper library for writing tests.

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

  2. Make your modifications in a branch, updating and writing new tests.

  3. Ensure that all tests pass

  4. rebase your changes against master. Do not merge.

  5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

d2l.security.oauth2's People

Contributors

anacoda avatar astadelbauer avatar brian-pearson avatar cbortos-d2l avatar cesar-d2l avatar dependabot[bot] avatar dylanjacobsd2l avatar j3parker avatar jcousins-cs avatar jeffashton avatar lboyd avatar maggiesazio avatar mpharoah-d2l avatar mthjones avatar neverendingqs avatar omsmith avatar toddlang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

d2l.security.oauth2's Issues

.NET code access security

Looks promising.

Should be non-breaking for users that aren't explicitly using CAS (.NET libraries use it themselves) but it is probably important to have at least one user to validate the design (likely candidate is the auth-service.)

Update details to inform client why auth failed on token timeouts.

suggests that we display "The access token is expired" to the client when a token has expired.

However, when using an expired token, the client is presented with {"title":"Authentication required","status":401,"detail":null}.

We are using:

<package id="D2L.Security.OAuth2" version="4.4.3.0" targetFramework="net452" />
<package id="D2L.Security.OAuth2.WebApi" version="3.3.1.0" targetFramework="net452" />

For the love of vs can we get some documentation?

I've been reading the code and trying to puzzle out what is needed to get with working and I am flabergasted. I've tried to look at the test code and get it integrated with my StartUp.Auth.cs but I'm banging my head against the wall.

Split ID2LPrincipal

The OAuth2 specific stuff should be factored out of ID2LPrincipal so that we can make ID2LPrincipal more sanely injectible in non-OAuth2.0 cases.

The namespace is OAuth2 specific which is a bit weird but better to get the split right so that the eventual refactor will/would be easier.

Error message for key lookup problems is vague/misleading

We have a single error message for failures to look up a remote key. Something like: "remote key xyz at URL abc could not be found".
This covers the following problems if I remember correctly:

  • Failure to resolve DNS
  • Failure to connect (TCP)
  • Failure to negotiate a TLS connection
  • Failure to find the key (404)
  • Key is expired

That last one burned us recently: a customer's key expired/wasn't rotated in time, and this lead to an outage for them. We worked from the bottom-up to diagnose this because we didn't notice that the exp timestamp on their key was old, and this delayed resolving the issue. If we had a more informative error message we could have resolved this much quicker.

Port D2L.Security.OAuth2 to .NET core

  • Remove System.Web.HttpMessage overloads
  • Switch from other serialization stuff to Newtonsoft.Json
  • Switch from System.Runtime.Caching to Microsoft.Framework.Caching.Memory for MemoryCache (possible breaking API changes?)
  • The type or namespace name AsymmetricSignature(De)formatter could not be found [OS: #36]
  • Possible SecurityKey/SecurityToken breaking API changes [OS: #36]
  • Where are JwtSecurityToken and JwtSecurityTokenHandler
  • D2LSecurityToken does not implement inherited abstract member SecurityToken.SigningKey.get [OS: #36]
  • Bring in DNX version of D2L.Services.Core.Extensions.
  • Build/bring in DNX version of D2L.Services.Core.Exceptions
  • Figure out Newtonsoft.Json
  • Netstandard D2L.CodeStyle.Annotations (Brightspace/D2L.CodeStyle#457) [OS: https://github.com//pull/109]

Consider a uniform version number for this suite of packages

This repo contains these NuGet packages:

D2L.Security.OAuth2
D2L.Security.OAuth2.WebApi
D2L.Security.OAuth2.TestFramework

They are currently versioned independently.

I think it'd make sense for them to be versioned in lock-step because these libraries are highly coupled (by design - the second ones are extensions) so it is confusing to keep track of compatibility versions of each currently.

It would also have some nice advantages for development: you can put all csproj into the same sln and use solution references instead of bringing them in as NuGet packages (what D2L.Security.OAuth2.WebApi has always had to do with D2L.Security.OAuth2.) Right now the feedback loop from change in core -> changes in WebApi is really annoying.

I think this would be a good general approach for the "core library + extensions" pattern.

Thoughts? @omsmith @brian-pearson @mpharoah-d2l

P.S.

The WebApi repo was merged into this one to make dev easier.

It matches the style of what MS is doing with .NET Core stuff (e.g. EntityFramework is many packages but one repo.)

AppVeyor CI also handles multiple-package case just swell.

Include reason for rejecting token if the route expects a service-level token, and a user-level was provided (and vice versa)

If a controller / route(?) is marked with [Authentication( users: true )], but a service-level token is provided, the client is presented with `{"Message":"Authorization has been denied for this request."} in the response.

(Not sure if there are any security concerns with explaining why).

Versions used:

<package id="D2L.Security.OAuth2" version="4.4.3.0" targetFramework="net452" />
<package id="D2L.Security.OAuth2.WebApi" version="3.3.1.0" targetFramework="net452" />

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.