<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How can we change authentication scope?</title><link>https://answers.axonivy.com/questions/253/how-can-we-change-authentication-scope</link><description>&lt;p&gt;Panda team is developing a Web application to change the configuration of Ivy server.
&lt;img alt="alt text" src="/upfiles/Capture.PNG"&gt; &lt;/p&gt;
&lt;p&gt;We are creating the login step, so that just the Ivy Admin can access our page.
Could you please tell us how to authenticate with the Ivy Administrator account (like the picture at the bottom)&lt;/p&gt;
&lt;p&gt;Panda team tried to do :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;public static AuthenticationException login(ISession session, String userName, String password) throws PersistencyException
{
    try
    {
        session.authenticateSessionUser(userName, new Password(password));
        return null;
    }
    catch(AuthenticationException ex)
    {
        return ex;
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The result is we just can login with the accounts (IUser) of our application, not the account to manage the server.&lt;/p&gt;
&lt;p&gt;Please help us. Thank you very much&lt;/p&gt;
&lt;p&gt;&lt;img alt="Login" src="/upfiles/login.PNG"&gt;&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/253/how-can-we-change-authentication-scope" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 17 Jan 2014 16:29:13 -0500</lastBuildDate><item><title>Answer by Reto Weiss</title><link>https://answers.axonivy.com/questions/253/how-can-we-change-authentication-scope/260</link><description>&lt;p&gt;You can make any user of an application a system administrator by granting him all permissions of the system security descriptor type on the system security descriptor.&lt;/p&gt;
&lt;p&gt;See SystemAdminMaker.java file below for more details.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note the class uses NON Public API and will therefore break in future releases of Xpert.ivy!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SystemAdminMaker.java:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;package ch.ivyteam.ivy.demo;

import ch.ivyteam.ivy.security.IPermissionGroup;
import ch.ivyteam.ivy.security.ISecurityDescriptor;
import ch.ivyteam.ivy.security.ISecurityManager;
import ch.ivyteam.ivy.security.IUser;
import ch.ivyteam.ivy.server.IServer;
import ch.ivyteam.ivy.server.ServerFactory;

// ============================================================
// ATTENTION:
// ============================================================
// The following code access NON PUBLIC API. 
// Therefore this code will break in future Xpert.ivy versions!
// ============================================================
public class SystemAdminMaker 
{
    public void grantSystemAdminRightsTo(IUser user)
    {
        ISecurityDescriptor systemSecurityDescriptor = getSystemSecurityDescriptor();       
        systemSecurityDescriptor.grantPermissions(getRootPermissionGroup(), user);
    }

    public void ungrantSystemAdminRightsTo(IUser user)
    {
        ISecurityDescriptor systemSecurityDescriptor = getSystemSecurityDescriptor();       
        systemSecurityDescriptor.ungrantPermissions(getRootPermissionGroup(), user);
    }

    private ISecurityDescriptor getSystemSecurityDescriptor() 
    {
        IServer server = ServerFactory.getServer();
        ISecurityManager securityManager = server.getSecurityManager();
        ISecurityDescriptor systemSecurityDescriptor = securityManager.getSystemSecurityDescriptor();
        return systemSecurityDescriptor;
    }

    private IPermissionGroup getRootPermissionGroup()
    {
        return getSystemSecurityDescriptor().getSecurityDescriptorType().getRootPermissionGroup();
    }
}
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reto Weiss</dc:creator><pubDate>Fri, 17 Jan 2014 16:29:13 -0500</pubDate><guid>https://answers.axonivy.com/questions/253/how-can-we-change-authentication-scope/260</guid></item></channel></rss>