Click here to Skip to main content
11,705,610 members (46,210 online)
Click here to Skip to main content
Add your own
alternative version

Secure Persistent ASP.NET Forms Authentication

, 27 Aug 2008 LGPL3 47.9K 505 51
An ASP.NET system for having two authentication cookies, one secure and one insecure, to have multiple tiers of security by folder.
' Copyright (c) 2008 Pathfinder Software, LLC.  All Rights Reserved.
' Pathfinder Software <http://www.pfasoft.com>
' PartialAuthenticationSystem is distributed under the terms of the GNU Lesser General Public License (GPL)

' PartialAuthenticationSystem is free software: you can redistribute it and/or modify
' it under the terms of the GNU Lesser General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.

' PartialAuthenticationSystem is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU Lesser General Public License for more details.

' You should have received a copy of the GNU Lesser General Public License
' along with PartialAuthenticationSystem.  If not, see <http://www.gnu.org/licenses/>.

Imports System.Configuration
Imports System.Web.Configuration

Public Class PartialAuthorizationSection
    Inherits ConfigurationSection

    Private Shared _initialized As Boolean
    Private Shared _properties As New ConfigurationPropertyCollection()
    Private Shared _propRequireSSL As New ConfigurationProperty("requireSSL", GetType(SslRequirement), SslRequirement.Optional)
    Private Shared _propRequireLogin As New ConfigurationProperty("requireLogin", GetType(Boolean), False)

    Protected Overrides ReadOnly Property Properties() As System.Configuration.ConfigurationPropertyCollection
        Get
            If Not _initialized Then
                _properties.Add(_propRequireSSL)
                _properties.Add(_propRequireLogin)
            End If

            Return _properties
        End Get
    End Property

    <ConfigurationProperty("requireSSL", DefaultValue:=SslRequirement.Optional)> _
    Public Property RequireSSL() As SslRequirement
        Get
            Return Item(_propRequireSSL)
        End Get
        Set(ByVal value As SslRequirement)
            Item(_propRequireSSL) = value
        End Set
    End Property

    <ConfigurationProperty("requireLogin", DefaultValue:=False)> _
    Public Property RequireLogin() As Boolean
        Get
            Return Item(_propRequireLogin)
        End Get
        Set(ByVal value As Boolean)
            Item(_propRequireLogin) = value
        End Set
    End Property

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

BrantBurnett
Software Developer (Senior) Pathfinder Software
United States United States
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150819.1 | Last Updated 27 Aug 2008
Article Copyright 2008 by BrantBurnett
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid