Giter Site home page Giter Site logo

farfetch / token-exchange Goto Github PK

View Code? Open in Web Editor NEW
22.0 7.0 1.0 50 KB

TokenExchange is a .NET Framework that implements the RFC 8693, OAuth 2.0 Token Exchange. This framework consists of a nuget package designed to be installed and used together with an authentication server using Identity Server 4, it extends it and implements the RFC in a very simple way.

License: MIT License

C# 100.00%
oauth2 identity farfetch nuget dotnet-core dotnet authorization authentication token-delegation hacktoberfest

token-exchange's Introduction

This project is no longer being actively maintained.

FARFETCH has decided to archive this project. As an alternative, you can find an example in Duende documentation.

We won't be accepting pull requests or responding to issues for this project anymore. Thank you for your understanding.

Build Master

Token Exchange

This framework extends Duende Identity Server capabilities by implementing support for Token Exchange following the specifications defined in the RFC 8693 - OAuth 2.0 Token Exchange.

Features

Currently, only a partial implementation of the RFC is available with focus on the security token delegation:

Supported

  • Token Exchange Delegation semantics;
  • Supported request parameters: subject_token, actor_token, subject_token_type, actor_token_type;
    • subject_token_type and actor token types are limited to urn:ietf:params:oauth:token-type:access_token;

Not Supported

  • Token Exchange Impersonation semantics;
  • requested_token_type is not supported and therefore ignored
  • may_act claim is not supported

Extensions to the RFC

  • client_act claim: The prefix client_ is added to the act claim in the response when a delegation is performed and the subject token only contains client details and no subject. This prefix is only added if your IdentityServer is configured to add the prefix "client_" to the Client claim.

Usage


Prerequisites

This framework consists of a nuget package designed to be installed and used together with an authentication server using Duende Identity Server.

  • It requires an authentication server built with Duende Identity Server >= 6.0.0

Installing

For you to able to start using the Token Exchange framework, you first need to install packages in your project. You can do it via NuGet Package Manager via the interface or the console.

PM> Install-Package IdentityServer.Contrib.TokenExchange

Configuration

The TokenExchange Framework provides a set of configurations that can be defined in the register of the framework. This configurations allows us to configure:

  • ActorClaimsToInclude: Sets the claims that must be in the Actor token;
  • ActorClaimsBlacklist: Sets a blacklist of claims that if they are found in the Actor Token the token will not be accepted;
  • SubjectClaimsToExclude: Sets a list of claims that will be excluded from the resulting token of the exchange;
var tokenExchangeOptions = new TokenExchangeOptions
            {
                ActorClaimsToInclude = new List<string> { TokenExchangeConstants.ClaimTypes.TenantId },
                ActorClaimsBlacklist = new List<string> { JwtClaimTypes.Subject },
                SubjectClaimsToExclude = new List<string> { JwtClaimTypes.AuthenticationMethod }
            };
	...
	...

services.AddTokenExchange(tokenExchangeOptions);

Building locally

To build a package of Token Exchange framework locally, you can use the following commands:

dotnet build
dotnet pack

After the execution of the commands above a new package will be created at src\IdentityServer.Contrib.TokenExchange\bin\Debug\IdentityServer.Contrib.TokenExchange.2.0.0.nupkg

Testing locally

How to run the automated tests:

dotnet test

Built with

Restrictions and Cautions

Describe the restrictions and Cautions around this project

  • PII Compliance
  • GDPR Compliance

Changelogs

See Changelog

Contributing

Read the Contributing guidelines

Disclaimer

By sending us your contributions, you are agreeing that your contribution is made subject to the terms of our Contributor Ownership Statement

Maintainers

List of Maintainers

License

MIT

token-exchange's People

Contributors

ademargoncalves avatar luisfilipegoncalves avatar lzbarros avatar renabeee avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ademargoncalves

token-exchange's Issues

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.