001package edu.pdx.cs410J.security;
002
003/**
004 * <P>This class demonstrates <code>SecurityManager</code>s and
005 * <code>Permission</code>s by attempting to access the
006 * <code>user.name</code> system property.</P>
007 *
008 * <P>This code should be run in three different modes:</P>
009 * <OL>
010 * <LI>With no security enabled</LI>
011 * <LI>With the default (applet level) security manager:
012 * <code>-Djava.security.manager</code></LI>
013 * <LI>With the a policy file containing the following permissions:
014 * <PRE>
015 * grant {
016 *   permission java.util.PropertyPermission "user.home", "read";
017 * };
018 * </PRE>
019 * </LI>
020 * </OL>
021 */
022public class PrintUser {
023  public static void main(String[] args) {
024    String userName = System.getProperty("user.name");
025    System.out.println("User: " + userName);
026  }
027}