Skip to content

bward/raven.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

raven.net

.NET Core Ucam-WebAuth and Raven application agent

With raven.net, the University of Cambridge Raven authentication service can be easily integrated into any .NET Core application.

The library provides various features which can be used either individually to integrate Raven into a pre-existing authentication system, or together for a ready-to-use authentication package (using Microsoft.AspNetCore.Authentication.Cookies). A demo project demonstrating everything below is available.

Quick start

Import the library with using BJW.Raven;. Inject a WebAuthClient:

public WebAuthClient RavenClientProvider(IServiceProvider provider)
{
  return new DemoWebAuthClient("http://localhost:63399");
}

and then

services.AddSingleton(RavenClientProvider);

in ConfigureServices. Also in ConfigureServices, load the controllers:

services.AddMvc().AddApplicationPart(Assembly.Load(new AssemblyName("BJW.Raven")))

Finally, configure your app to use Raven cookie authentication in Configure, above app.useMvc:

app.UseCookieAuthentication(CookieAuthentication.DefaultOptions);

Raven authentication is now enabled - to use it, just add [Authorise] attributes to to controllers which require authentication to access.

Reference

WebAuthClient

public WebAuthClient(baseUrl)

A client which performs Raven authentication

  • baseUrl: the FQDN of your app

public Uri AuthenticationUrl(string desc = "")

Returns the address of the Raven login form.

  • desc: optional description displayed to the user at the login prompt

public AuthenticationResponse ParseResponse(string data)

Returns an AuthenticationResponse object given

  • data: the raw data recieved back from Raven

public bool Verify(AuthenticationResponse response)

Verifies an AuthenticationResponse as described in the protocol documentation. Returns true if a user logged in successful, false otherwise.

DemoWebAuthClient

public DemoWebAuthClient(baseUrl)

A client which connects to the demonstration authentication service

About

.NET Core Ucam-WebAuth and Raven application agent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages