`

Something about SecurityManager

阅读更多

The Java Security was made up of ClassLoader, Class file inspection, built-in security and securityManager.
The built-in security includes safely type cast, structural memory access, GC, bound check of array, null reference check.
The first three parts can ensure the integrity of the running program and JVM instance. However, SecurityManager attempts to protect the outer resource from being attacked by millions lines of code.
When a program starts, it will point to a java.lang.SecurityManager or pass its subtype's instance to setSecurityManager method as a parameter to install the SecurityManager. If it doesn't do so, the Java API can do anything without any restriction. Before the version 1.2, java.lang.SecurityManager was an abstract class and now it is a concrete class supplying a default implementation.
SecurityManager permits users to define policies without coding only by defining a file named policy file (ASIIC file). The permission is defined as a class extending from java.security.Permission, such as java.io.FilePermission to grant reading, writing, and executing permissions. When a SecurityManager is created, it will parse the policy file and generate the CodeSource and Permission Objects, which are encapsulated in a single Policy Object representing a runtime policy. Anytime there will be only one Policy installed Object.

 When the check methods of a SecurityManager are called, many of them will pass the requests to an AccessControl Class. There are 28 different check methods in the old version and there are two another methods added into the version after 1.2, which are checkPermission(Permission) and checkPermission(Permission,Object).

 

Here is an example of one policy file called policy.txt

keystore "ijvmkeys";

grant signedBy "friend" {
    permission java.io.FilePermission "question.txt", "read";
    permission java.io.FilePermission "answer.txt", "read";
};

grant signedBy "stranger" {
    permission java.io.FilePermission "question.txt", "read";
};

grant codeBase "file :${com.artima.ijvm.cdrom.home}/security/ex2/-" {
 permission java.io.FilePermission "question.txt", "read";
 permission java.io.FilePermission "answer.txt", "read";
};

 

It points out that if you use a jar package signed by "friend", you can read two files - question.txt and answer.txt; otherwise if you are "stranger", you can only read the question.txt.

The third segment means the policy file grants a read permission to the class file whose location is under the ${com.artima.ijvm.cdrom.home}/security/ex2/

 

The original article was edited by the blogger for correcting several grammar mistakes.

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/liuxizhiyi/archive/2008/10/23/3129893.aspx

 

 

分享到:
评论

相关推荐

    SecurityManager使用

    在Java编程语言中,`SecurityManager`(安全管理器)是一个重要的安全组件,它允许开发者对应用程序的安全性进行精细控制。`SecurityManager`是Java虚拟机(JVM)的一部分,用于实施一套安全策略,以防止代码执行...

    浅谈shiro的SecurityManager类结构

    在 Shiro 中,`SecurityManager` 是核心组件,它负责整个安全体系的管理和协调工作。本文将深入探讨 `SecurityManager` 的类结构及其主要职责。 首先,`SecurityManager` 是 Shiro 的核心接口,它在 Shiro 中起着...

    39.2. Spring Boot Shiro权限管理【从零开始学Spring Boot】

    public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager) { ShiroFilterFactoryBean factoryBean = new ShiroFilterFactoryBean(); factoryBean.setSecurityManager(securityManager); Map...

    securesm:解决Java中设计缺陷的SecurityManager实现

    然而,由于历史原因,`SecurityManager`在某些情况下可能存在设计缺陷,`securesm`项目正是为了解决这些问题,提供一个更加健壮和安全的`SecurityManager`实现。 `SecurityManager`的工作原理是通过检查系统调用,...

    JFinal2.0整合shiro权限框架,简单好用

    - **启动Shiro**:在JFinal的启动类中,初始化Shiro环境,创建SecurityManager,并注入自定义的Realm。 - **使用Shiro标签**:在视图层,可以利用Shiro的标签库,如`<shiro:hasPermission>`、`<shiro:principal>`等...

    dappFinance#Note#【Java多线程】安全管理器SecurityManager1

    创建安全管理器利用安全管理器public static void main(String args[]){方法调用此方法时,返回所有新创建的线程实例化后所在的线

    SecurityManager:Web 应用程序配置不同应用程序的 RBAC-开源

    【标题】"SecurityManager:Web 应用程序配置不同应用程序的 RBAC-开源" 指的是一款基于Web的安全管理工具,它实现了角色基础访问控制(Role-Based Access Control,简称RBAC)的概念,用于管理多个应用程序的安全...

    fab-oidc:适用于OpenIDConnect的Flask-AppBuilder SecurityManager

    适用于OpenIDConnect的Flask-AppBuilder SecurityManager 包装,公开了可与任何Flask-AppBuilder应用一起使用的SecurityManager 。 它将允许您的用户使用OpenIDConnect提供程序(例如Auth0,Okta或Google Apps)...

    sandboxexperiment:演示使用SecurityManager的自我保护沙箱

    这是使用Scala编写的Java SecurityManager对沙盒代码的实现。 它从Jens Nordahl的汲取了灵感,尽管花了点时间才能看清参数是什么。 它由一个Main类组成,该类启动一个沙箱,然后从该沙箱中启动一个脚本。 跑步 ...

    jfinal+shiro整合的一个例子

    2. **配置Shiro**:在项目的初始化阶段,需要配置Shiro的`SecurityManager`,这是Shiro的核心组件,负责管理安全相关的操作。同时,还需要配置认证和授权的相关策略,如 Realm(域)的设置, Realm是Shiro与应用数据...

    【SpringBoot】廿三、SpringBoot中整合Shiro实现权限管理.pdf

    public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager) { AuthorizationAttributeSourceAdvisor advisor = new ...

    shiro框架使用简易教程

    SecurityManager securityManager=factory.getInstance(); SecurityUtils.setSecurityManager(securityManager); ``` 然后,我们可以获取当前执行用户Subject,创建令牌token,并进行身份认证。例如: ``` Subject ...

    ShiroDemo.rar

    Shiro安全框架,整合了springboot项目,作为认证和授权两大功能 ... SecurityManager:它是Shiro框架的核心,典型的Facade模式,Shiro通过SecurityManager来管理内部组件实例,并通过它来提供安全管理的各种服务。

    Shiro原理+配置

    三个核心组件:Subject, SecurityManager 和 Realms. Subject:即"当前操作用户"。但是,在Shiro中,Subject这一概念并不仅仅指人,也可以是第三方进程、后台帐户(Daemon Account)或其他类似事物。它仅仅意味着"当前...

    Security Managers and Permissions

    在Java编程语言中,安全管理器(Security Manager)和权限(Permissions)是确保应用程序安全的关键组件。它们构成了Java安全模型的核心,防止恶意代码对系统资源进行未经授权的访问或操作。这篇博文将深入探讨这两...

    shiro.docx

    public SecurityManager securityManager(Realm myRealm){ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); securityManager.setRealm(myRealm); return securityManager; } ...

    shiro源码分析

    Shiro提供了多种SecurityManager的实现,例如IniSecurityManagerFactory,它通过配置文件来初始化SecurityManager。我们可以通过工厂模式获得SecurityManager,这是通过Factory接口实现的。其中,AbstractFactory为...

    权限管理框架学习-shrio.ppt

    Shiro架构主要由Subject、SecurityManager、Realm、Authenticator、Authorizer、SessionManager、CacheManager和Cryptography等组件组成。 * Subject:即主体,外部应用与Subject进行交互,记录了当前操作用户,将...

    shiro认证.pdf

    SecurityManager securityManager = factory.getInstance(); // 将SecurityManager设置为当前的SecurityUtils的实例 SecurityUtils.setSecurityManager(securityManager); // 获取Subject并创建Token Subject ...

    39.3 Spring Boot Shiro权限管理【从零开始学Spring Boot】

    SecurityManager securityManager = context.getBean(SecurityManager.class); SecurityUtils.setSecurityManager(securityManager); // 开启Shiro的Web支持 FilterRegistrationBean filterRegistrationBean = ...

Global site tag (gtag.js) - Google Analytics