AspNetCore.Security.CAS 2.0.2

AspNetCore.Security.CAS Class Library

There is a newer version of this package available.
See the version list below for details.
Install-Package AspNetCore.Security.CAS -Version 2.0.2
dotnet add package AspNetCore.Security.CAS --version 2.0.2
<PackageReference Include="AspNetCore.Security.CAS" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.Security.CAS --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AspNetCore.Security.CAS, 2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install AspNetCore.Security.CAS as a Cake Addin
#addin nuget:?package=AspNetCore.Security.CAS&version=2.0.2

// Install AspNetCore.Security.CAS as a Cake Tool
#tool nuget:?package=AspNetCore.Security.CAS&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

AspNetCore.Security.CAS

AspNet.Security.CAS is an ASP.NET Core 2/MVC 6 authentication provider for CAS.

Microsoft.AspNetCore.Authentication.OAuth and Microsoft.AspNetCore.Authentication.Twitter were used as structural references.

Usage

  1. Install the NuGet package

    PM> Install-Package AspNetCore.Security.CAS

  2. Open Startup.cs

  3. In your startup's ConfigureServices method:

     services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
     	.AddCookie(options =>
     	{
     		options.LoginPath = new PathString("/login");
     	})
     	.AddCAS(options =>
     	{
     		options.CasServerUrlBase = Configuration["CasBaseUrl"];   // Set in `appsettings.json` file.
     		options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
     	});
    
  4. In your startup's Configure method before UseMvc:

    app.UseAuthentication();
    
  5. In a controller somewhere, create a login endpoint. It doesn't have to auto-challenge/redirect but this example does:

    [AllowAnonymous]
    [Route("login")]
    public async Task Login(string returnUrl)
    {
        var props = new AuthenticationProperties { RedirectUri = returnUrl };
        await HttpContext.ChallengeAsync("CAS", props);
    }
    

CasOptions

At a minmum, the CasOptions object needs to have the CasServerUrlBase property set to the URL to your CAS server.

These options extend the RemoteAuthenticationOptions class.

Properties

Property Description Default
CasServerUrlBase The base url of the CAS server. Required. null
CasValidationUrl Used in cases where ticket validation occurs on a separate server than user login. Optional. null
TicketValidator Gets or sets the ICasTicketValidator used to validate tickets from CAS. Cas2TicketValidator
StateDataFormat Gets or sets the type used to secure data handled by the middleware. PropertiesDataFormat
NameIdentifierAttribute If set, and using the CAS 2 payload, the ticket validator use the specified CAS attribute as the NameIdentifier claim, which is used to associate external logins. null
Renew If this parameter is set, single sign-on will be bypassed. In this case, CAS will require the client to present credentials regardless of the existence of a single sign-on session with CAS. false
Gateway If this parameter is set, CAS will not ask the client for credentials. If the client has a pre-existing single sign-on session with CAS, or if a single sign-on session can be established through non-interactive means (i.e. trust authentication), CAS MAY redirect the client to the URL specified by the service parameter, appending a valid service ticket. false

See the documentation for optional properties for more information if using Renew or Gateway.

Other .NET CAS Providers

MVC 5: Owin.Security.CAS

MVC 4 and below: Jasig's .NET CAS Client

MIT license

AspNetCore.Security.CAS

AspNet.Security.CAS is an ASP.NET Core 2/MVC 6 authentication provider for CAS.

Microsoft.AspNetCore.Authentication.OAuth and Microsoft.AspNetCore.Authentication.Twitter were used as structural references.

Usage

  1. Install the NuGet package

    PM> Install-Package AspNetCore.Security.CAS

  2. Open Startup.cs

  3. In your startup's ConfigureServices method:

     services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
     	.AddCookie(options =>
     	{
     		options.LoginPath = new PathString("/login");
     	})
     	.AddCAS(options =>
     	{
     		options.CasServerUrlBase = Configuration["CasBaseUrl"];   // Set in `appsettings.json` file.
     		options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
     	});
    
  4. In your startup's Configure method before UseMvc:

    app.UseAuthentication();
    
  5. In a controller somewhere, create a login endpoint. It doesn't have to auto-challenge/redirect but this example does:

    [AllowAnonymous]
    [Route("login")]
    public async Task Login(string returnUrl)
    {
        var props = new AuthenticationProperties { RedirectUri = returnUrl };
        await HttpContext.ChallengeAsync("CAS", props);
    }
    

CasOptions

At a minmum, the CasOptions object needs to have the CasServerUrlBase property set to the URL to your CAS server.

These options extend the RemoteAuthenticationOptions class.

Properties

Property Description Default
CasServerUrlBase The base url of the CAS server. Required. null
CasValidationUrl Used in cases where ticket validation occurs on a separate server than user login. Optional. null
TicketValidator Gets or sets the ICasTicketValidator used to validate tickets from CAS. Cas2TicketValidator
StateDataFormat Gets or sets the type used to secure data handled by the middleware. PropertiesDataFormat
NameIdentifierAttribute If set, and using the CAS 2 payload, the ticket validator use the specified CAS attribute as the NameIdentifier claim, which is used to associate external logins. null
Renew If this parameter is set, single sign-on will be bypassed. In this case, CAS will require the client to present credentials regardless of the existence of a single sign-on session with CAS. false
Gateway If this parameter is set, CAS will not ask the client for credentials. If the client has a pre-existing single sign-on session with CAS, or if a single sign-on session can be established through non-interactive means (i.e. trust authentication), CAS MAY redirect the client to the URL specified by the service parameter, appending a valid service ticket. false

See the documentation for optional properties for more information if using Renew or Gateway.

Other .NET CAS Providers

MVC 5: Owin.Security.CAS

MVC 4 and below: Jasig's .NET CAS Client

MIT license

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.0.5 40,773 5/3/2019
2.0.4 4,361 6/29/2018
2.0.3 562 6/21/2018
2.0.2 1,444 4/10/2018
2.0.1 5,104 10/11/2017
1.1.0 627 10/11/2017
1.0.0 1,689 6/30/2016