JAAS Authentication Example Error

I am working with the JAAS Authentication example provided by Sun at the following link:
http://java.sun.com/j2se/1.4.1/docs/guide/security/jgss/tutorials/index.html
I am working with Windows NT. I am using a NTLoginModule in my config file. I would like to create a simple Login that uses the current OS's user ID. Once I add the security.manager and a policy file that includes anything besides full permisions (permission java.security.AllPermission;), I get a Security Exception, and more specifically a "java.security.AccessControlException:access denied...".
I am using the following config:
JaasConfig {
com.sun.security.auth.module.NTLoginModule required debug="true";
I would like to use a policy file that gives permission to a file for the current user. I would like to do something similar to the following, but get the error once this is added....
grant Principal com.sun.security.auth.NTUserPrincipal "user"
//Allow everything for now
//permission java.security.AllPermission;
permission java.io.FilePermission "ProtectedFile.txt", "read , write";
What am I doing wrong? Any help is very much appreciated!
Thanks!

I got it...my policy file needed more to work in NT. Here is the entire file:
grant Principal com.sun.security.auth.NTUserPrincipal "s156898"
     permission java.io.FilePermission "ProtectedFile.txt", "read";
grant {
//Allow everything for now
//permission java.security.AllPermission;
     permission javax.security.auth.AuthPermission "createLoginContext.JAASConfig"     permission java.io.FilePermission "ProtectedFile.txt", "read";
     permission javax.security.auth.AuthPermission "modifyPrincipals";
     permission javax.security.auth.AuthPermission "doAsPrivileged";
     permission javax.security.auth.AuthPermission "getSubject";
However, I am trying to also do my work on a Solaris/Unix machine. I get an error that tells me that only Principal-based entries are allow. Anyone know how to give permission to all users in a Principal statemtent. The same setup as the above, using Unix Principals, will not work. Seems like I have to always have a grant and Principal for every set of permissions.
Lemme know if you can help. Thanks!

Similar Messages

  • RDBMS Authentication Example Error

    When I test the code
    weblogic.security.acl.CachingRealm realm = (weblogic.security.acl.CachingRealm)
    weblogic.security.acl.Security.getRealm();
    The Error was raised:
    java.lang.ClassCastException: weblogic.security.acl.internal.FileRealm
    It is a example in book 'J2EE Application and BEA WebLogic Server'

    I got it...my policy file needed more to work in NT. Here is the entire file:
    grant Principal com.sun.security.auth.NTUserPrincipal "s156898"
         permission java.io.FilePermission "ProtectedFile.txt", "read";
    grant {
    //Allow everything for now
    //permission java.security.AllPermission;
         permission javax.security.auth.AuthPermission "createLoginContext.JAASConfig"     permission java.io.FilePermission "ProtectedFile.txt", "read";
         permission javax.security.auth.AuthPermission "modifyPrincipals";
         permission javax.security.auth.AuthPermission "doAsPrivileged";
         permission javax.security.auth.AuthPermission "getSubject";
    However, I am trying to also do my work on a Solaris/Unix machine. I get an error that tells me that only Principal-based entries are allow. Anyone know how to give permission to all users in a Principal statemtent. The same setup as the above, using Unix Principals, will not work. Seems like I have to always have a grant and Principal for every set of permissions.
    Lemme know if you can help. Thanks!

  • JAAS authentication with WebLogic 6 - "Invalid Configuration Class Name"

    For starters, I took the sample file examples.security.jaas.SampleConfig, changed the name and
    package, compiled, and copied it to the right place in the classes directory of the webapp project.
    The class is specified as a parameter in startWebLogic.cmd:
    -Dweblogic.security.jaas.Configuration="com.ww.opd.auth.JAASConfiguration"
    When a servlet attempts to get LoginContext, I get this error:
    "Invalid Configuration Class Name: com.ww.opd.auth.JAASConfiguration"
    The class file is definitely in the right place. What's the deal?
    Thanks,
    Rob

    Seems to be a ClassLoader problem. The sample is a client app, so no problem. But if you create
    a Configuration class to run on the server (to set up a LoginModule for authenticating clients)...
    I think what's happening is that the System class loader, using the CLASSPATH in the environment
    of the WebLogic server when it starts, attempts to load the Configuration class and can't (because it
    is in the CLASSPATH of the web app, not of the System class loader). If you add the Configuration
    class to the CLASSPATH of the WebLogic server, then it gets loaded but the LoginModule can't be
    found. If you add the LoginModule to the WebLogic server CLASSPATH, then any classes that it calls
    must also be in the WebLogic server CLASSPATH.
    Could someone from BEA please comment: is that the intention, that any classes used for JAAS
    authentication be part of the server's CLASSPATH, not part of the web application?
    Thanks,
    Rob
    "Rob Weltman" <[email protected]> wrote:
    >
    For starters, I took the sample file examples.security.jaas.SampleConfig, changed the name and
    package, compiled, and copied it to the right place in the classes directory of the webapp project.
    The class is specified as a parameter in startWebLogic.cmd:
    -Dweblogic.security.jaas.Configuration="com.ww.opd.auth.JAASConfiguration"
    When a servlet attempts to get LoginContext, I get this error:
    "Invalid Configuration Class Name: com.ww.opd.auth.JAASConfiguration"
    The class file is definitely in the right place. What's the deal?
    Thanks,
    Rob

  • Using Identity Server as a JAAS authentication provider

    My client wants to use Identity Server to provide JAAS authentication for the Java application they're developing.
    The JAAS tutorial shows how the name of the Java class that provides the authentication service is provided, then an instance of this class is instantiated and the .login method invoked to actually perform the authentication.
    The stated principle behind the tutorial is one of using a pluggable authentication framework, and one should not care how authentication is performed. As long as the callbacks to allow the authentication framework to ask for the credentials required, it should not matter.
    The example of how to do LDAP authentication using Identity server requires using some identity server classes. ie the com.sun.identity.authentication.AuthContext class. They specifically want to use pure JAAS authentication rather than creating a dependance in their application on Identity Server.
    Is a Java class available which provides this functionality?
    Thanks

    In Apache you can specify the authentication parameters in the virtual host configuration

  • Java authentication example  jsp

    1) season variable is builtin jsp context object, so jsp does
    not compile; season variable name needs to be renamed at lines: 31
    , 45, 52
    for my jsp I named it coco_season :)
    2) String select(String r) {// takes String
    return r.equals(role) ? "selected" : "";
    select(100) // passes int. need to pas select("100")

    Hi, when I try to run the php authentication example I get the error
    "You don't have permission to access /cnx/Flexternal.html on this server."  cnx is my folder name at http://cardcrackers.com/cnx/
    I checked the unix permissions and set them to 777 and still this message. I remember reading something about adding some entries to htaccess but not sure if it was related to running this example app or not.
    Thanks, Kevin

  • Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW050 ...

    Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW050 ... Exit Code: 6 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW050 ... -------------------------------------- Summary -------------------------------------- - 0 fatal error(s), 2 error(s), 0 warning(s) ERROR: DW050: The following payload errors were found during install: ERROR: DW050:  - Microsoft Visual C++ 2010 Redistributable Package (x64): Install failed ERROR: DW050:  - Microsoft Visual C++ 2010 Redistributable Package (x86): Install failed -------------------------------------- Summary -------------------------------------- - 0 fatal error(s), 2 error(s), 0 warning(s) ERROR: DW050: The following payload errors were found during install: ERROR: DW050:  - Microsoft Visual C++ 2010 Redistributable Package (x64): Install failed ERROR: DW050:  - Microsoft Visual C++ 2010 Redistributable Package (x86): Install failed
    PS CS6,Please help!

    Errors "Exit Code: 6," "Exit Code: 7"
    Mylenium

  • Problems with basic authentication example

    I am trying to run the basic authentication example from the Professional JSP book (Chapter 16) although for some reason I continue to get "AUTHENTICATION MECHANISM NULL" instead of "AUTHENTICATION MECHANISM BASIC". I do not even get the pop-up window with the prompt for Username and Password. I am running Tomcat 4.0-dev and have tried to access the login window by pointing the browser to the appropriate file:
    //localhost:8080/ch16-basic/index.jsp
    Still not login window???
    I have added the extra user and password to the tomcat-users.xml file (username="projsp" password="projsp" roles="superuser")
    Still no luck????
    Could someone please let me know what could possibly be going wrong.
    Thank you!!!!

    The index.jsp is:
    <html>
    <head>
    <title>Protected Area Page</title>
    </head>
    <body>
    <%
    out.println("<H2>Authentication Mechanism "+ request.getAuthType() +" </H2>" );
    %>
    </body>
    </html>
    The tomcat-users.xml is:
    <!--
    NOTE: By default, no user is included in the "manager" role required
    to operate the "/manager" web application. If you wish to use this app,
    you must define such a user - the username and password are arbitrary.
    -->
    <tomcat-users>
    <user name="tomcat" password="tomcat" roles="tomcat" />
    <user name="role1" password="tomcat" roles="role1" />
    <user name="both" password="tomcat" roles="tomcat,role1" />
    <user name="projsp" password="projsp" roles="superuser" />
    </tomcat-users>
    And the web.xml is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>Entire Application</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    </security-constraint>
    <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>ProJSP Authentication Example</realm-name>
    </login-config>
    </web-app>
    WHY ISN"T THIS WORKING!!!!

  • JAAS Authentication

    Hi,
    how can JAAS be used with sjsws? Are there JAAS-Howtos or other documents dealing with JAAS? Examples?
    I have an already implemented JAAS-Login module using the javax.security.auth.spi.LoginModule interface.
    Is it possible to use it with sjsws? How? Where can I configure what Principals are possible?
    Can I use JAAS to authenticate webdav-users? How?
    Yours
    Arne
    Edited by: Arne.v.Irmer on Nov 22, 2007 8:02 AM

    Hi mv,
    our JAAS-LoginModule is too complex to post it here. I made a small example, that is near to what we do here.
    It authenticates the user "user" with the role/principal "userRole" and the user "admin" with the role "adminRole". Both have the principal "authenticateduser". Passwords are the same as the account.
    Here is the LoginModule:
    package sample.security.jaas;
    import java.io.IOException;
    import java.util.Map;
    import javax.security.auth.Subject;
    import javax.security.auth.callback.Callback;
    import javax.security.auth.callback.CallbackHandler;
    import javax.security.auth.callback.NameCallback;
    import javax.security.auth.callback.PasswordCallback;
    import javax.security.auth.callback.UnsupportedCallbackException;
    import javax.security.auth.login.LoginException;
    import javax.security.auth.spi.LoginModule;
    public class TestLoginModule implements LoginModule {
         private CallbackHandler callbackHandler;
         private Subject subject;
         private boolean success;
         public boolean abort() throws LoginException {
            // Clean out state
            success = false;
            logout();
            return true;
         public boolean commit() throws LoginException {
              if (success){
                   //Add a general principal
                   subject.getPrincipals().add(new TestPrincipal("authenticateduser"));
                   System.out.println("authenticateduser");
              return true;
         public void initialize(Subject subject, CallbackHandler callbackHandler,
                   Map<String, ?> sharedState, Map<String, ?> options) {
            // save the initial state
            this.callbackHandler = callbackHandler;
            this.subject = subject;
         public boolean login() throws LoginException {
            // Setup default callback handlers.
            Callback[] callbacks = new Callback[] {
                    new NameCallback("Username: "),
                    new PasswordCallback("Password: ", false)
            try {
                callbackHandler.handle(callbacks);
            } catch (IOException e) {
            } catch (UnsupportedCallbackException e) {
            String username = ((NameCallback)callbacks[0]).getName();
            String password = new String(((PasswordCallback)callbacks[1]).getPassword());
            ((PasswordCallback)callbacks[1]).clearPassword();
            //Check passwords and add principals
            if(username!=null){
                 success = username.equalsIgnoreCase("admin") && password.equals("admin");
                 if(success){
                      subject.getPrincipals().add(new TestPrincipal("adminRole"));
                 }else{
                     success = username.equalsIgnoreCase("user") && password.equals("user");
                     if(success){
                          subject.getPrincipals().add(new TestPrincipal("userRole"));
            } else
                 success=false;
            callbacks[0]=callbacks[1]=null;
            return true;
         public boolean logout() throws LoginException {
            // remove the principals
            subject.getPrincipals(TestPrincipal.class).removeAll(subject.getPrincipals(TestPrincipal.class));
              return false;
    }And here is the Principal:
    package sample.security.jaas;
    import java.io.Serializable;
    import java.security.Principal;
    public class TestPrincipal implements Principal, Serializable {
        private String uniqueIdentifier;
        public TestPrincipal(String uniqueIdentifier) {
            this.uniqueIdentifier = uniqueIdentifier;
        public String getName() {
            return this.uniqueIdentifier;
    }You can download this code in a small project at
    http://ews2.uni-dortmund.de/installation/jaas-src.tgz_
    or if you want a tomcat 5.5.23 using this LoginModule to authenticate under
    http://ews2.uni-dortmund.de/installation/jaastest.tgz_
    I'm curious about your answer.
    Yours
    Arne

  • Is it possible to bypass JAAS authentication and use Authorisation alone?

    I have to implement jsp level security (by checking roles) for my JSF application.
    Authentications in my appln are done by a different servers. I don't want to disturb that.
    I have to implement authorisation alone using JAAS.
    Is it possible to bypass JAAS authentication and use Authorisation alone?
    I am using custom login module( implements DatabaseLoginModule) for authorisation.
    Moreover, after logging in, when a user tries to access a secured jsp page, he should NOT be redirected to login page again. Rather the role checks should be done using existing user credentials stored somewhere. How to invoke the custom DataBaseLoginModule without taking user to login screen?
    Any help would be great.
    Thanks,
    Adhil.J

    I have to implement jsp level security (by checking roles) for my JSF application.
    Authentications in my appln are done by a different servers. I don't want to disturb that.
    I have to implement authorisation alone using JAAS.
    Is it possible to bypass JAAS authentication and use Authorisation alone?
    I am using custom login module( implements DatabaseLoginModule) for authorisation.
    Moreover, after logging in, when a user tries to access a secured jsp page, he should NOT be redirected to login page again. Rather the role checks should be done using existing user credentials stored somewhere. How to invoke the custom DataBaseLoginModule without taking user to login screen?
    Any help would be great.
    Thanks,
    Adhil.J

  • Failed to install Ligthroom CC  Exit Code: 9999 Please see specific errors below for troubleshooting. For example, ERROR:  Summary  0 fatal error(s), 0 error(s) Mac

    Failed to install Ligthroom CC  Exit Code: 9999 Please see specific errors below for troubleshooting. For example, ERROR:  Summary  0 fatal error(s), 0 error(s) Mac

    Exit Code: 6, Exit Code: 7 Installation Errors - http://helpx.adobe.com/creative-suite/kb/errors-exit-code-6-exit.html
    Troubleshoot with install logs | CS5, CS5.5, CS6 - http://helpx.adobe.com/creative-suite/kb/troubleshoot-install-logs-cs5-cs5.html for information on how to review your installation logs

  • Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR: DW013 ...  -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 6 error(s)   ERROR: -------------------- BEGIN -

    Exit Code: 7
    Please see specific errors below for troubleshooting. For example, ERROR: DW013 ...
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 6 error(s)
    ERROR: -------------------- BEGIN - Initialization Failures - BEGIN --------------------
    ERROR: Fatal error initializing from proxy files.
    ERROR: The following proxy files could not be loaded
    ERROR: /tmp/AB24A935-0FB4-4D57-A6C8-73C0BF15A96E/proxy.xml
    ERROR: -------------------- END - Initialization Failures - END --------------------
    ERROR: DW013: Cannot initialize payload session

    cs5,cs5.5: https://helpx.adobe.com/creative-suite/kb/errors-exit-code-6-exit.html
    lightroom: http://helpx.adobe.com/lightroom/kb/exit-code-7-displays-installing.html
    photoshop elements 13: https://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-installation-errors-exit- codes-6-7.html
    premiere elements: http://helpx.adobe.com/premiere-elements/kb/updated-installation-instructions-premiere-ele ments.html

  • Exit Code: 7 Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW042 ... WARNING: DW066 ...  -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 1 error(s), 2 war

    Exit Code: 7
    Please see specific errors and warnings below for troubleshooting. For example,  ERROR: DW042 ... WARNING: DW066 ...
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 1 error(s), 2 warning(s)
    WARNING: DW066: OS requirements not met for {FA19351D-E98C-48C1-B5E1-0C8C42B5E11C}
    WARNING: DW066: OS requirements not met for {F7FD5B5C-CE79-4657-AEB7-B0EE4626C912}
    ERROR: DW042: ARP Entry couldn't be created for language : en_US
    What the heck does this mean???

    Trying to install Photoshop Elements 11 on Mac OS 10.6.8 with Quicktime 7 also installed. Machine is 21.5" iMac 3.06GHz Core 2 Duo. It was on there before. Had a problem and threw it out to reinstall. Any attempt at reinstall gets same error. Even downloaded the installer from Adobe's site and get same error.

  • I have tried to install Adobe Ilustrator but I receive an error Exit Code: 6 Please see specific errors below for troubleshooting. For example,  ERROR:    -------------------------------------- Summary --------------------------------------   - 0 fatal er

    Exit Code: 6 Please see specific errors below for troubleshooting. For example,  ERROR:   -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 4 error(s)    ----------- Payload: Microsoft Visual C++ 2012 Redistributable Package (x64) 11.0.61030.0 {3E272A93-C06B-4206-AD02-0EBE02535E20} -----------  ERROR: Third party payload installer vcredist_x64.exe failed with exit code: -2147024546  ERROR: Failed to install Microsoft Visual C++ 2012 Redistributable Package (x64). Please try installing it by double clicking on the executable at "C:\Users\amorales\AppData\Local\Temp\{6A3B9341-4D14-415F-8A21-85327165545E}\Illustrator_18_LS20_win64\Adobe Illustrator CC 2014\payloads\Microsoft VC 2012 Redist (x64)\vcredist_x64.exe", or download and install the latest Microsoft Visual C++ 2012 Redistributable Package (x64) from Microsoft website - www.microsoft.com  ----------- Payload: Microsoft Visual C++ 2012 Redistributable Package (x86) 11.0.61030.0 {873BE68F-480F-49A6-9649-F98CAB056AFC} -----------  ERROR: Third party payload installer vcredist_x86.exe failed with exit code: -2147024546  ERROR: Failed to install Microsoft Visual C++ 2012 Redistributable Package (x86). Please try installing it by double clicking on the executable at "C:\Users\amorales\AppData\Local\Temp\{6A3B9341-4D14-415F-8A21-85327165545E}\Illustrator_18_LS20_win64\Adobe Illustrator CC 2014\payloads\Microsoft VC 2012 Redist (x86)\vcredist_x86.exe", or download and install the latest Microsoft Visual C++ 2012 Redistributable Package (x86) from Microsoft website - www.microsoft.com  -------------------------------------------------------------------------------------

    Errors "Exit Code: 6," "Exit Code: 7"
    Mylenium

  • I can't download flash cc.  It says" Exit Code: 16 Please see specific errors below for troubleshooting. For example,  ERROR: DW039 ...  -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 1 error(s)

    I can't download flash cc. 
    It says" Exit Code: 16 Please see specific errors below for troubleshooting.
             For example,  ERROR: DW039 ... 
             -------------------------------------- Summary --------------------------------------
              - 0 fatal error(s), 1 error(s)   ERROR: DW039: Failed to load deployment File
    I use mac.

    read the instructions to run the cleaner, Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    and then install.

  • Every time I try to update Muse to 2014.3 version in my mac (OS X 10.10.2) I get this error message: "Exit Code: 39 Please see specific errors below for troubleshooting. For example,  ERROR: DW042 ...  ---- Summary   - 0 fatal error(s), 2 error(s)   ERROR

    Every time I try to update Muse to 2014.3 version in my mac (OS X 10.10.2) I get this error message: "Exit Code: 39 Please see specific errors below for troubleshooting. For example,  ERROR: DW042 ...  ---- Summary   - 0 fatal error(s), 2 error(s)   ERROR: Failed CreateAlias ERROR: DW042: ARP Entry couldn't be created for language : es_ES". I've tried both to uninstall the app and run CleanTooler, but there's no way. What else should I do?

    Davidv82268468 have you removed and reinstalled Adobe Muse using the steps listed in CC desktop lists applications as "Up to Date" when not installed?

Maybe you are looking for