Package com.adito.security

Examples of com.adito.security.User


    }

    private boolean setDefaultUser(String[] toMatch) throws Exception {
        for (String username : toMatch) {
            if (!Util.isNullOrTrimmedBlank(username) && userDatabase.isAccountNameInUse(username)) {
                User user = userDatabase.getAccount(username);
                account = user.getPrincipalName();
                email = user.getEmail();
                return true;
            }
        }
        return false;
    }
View Full Code Here


                        .booleanValue();

        String formParameters = (String) seq.getAttribute(WebForwardAuthenticationDetailsForm.ATTR_FORM_PARAMETERS, "");
        String formType = (String) seq.getAttribute(WebForwardAuthenticationDetailsForm.ATTR_FORM_TYPE, "");
        boolean autoStart = false; // TODO this needs to be hooked in
        User user = this.getSessionInfo(request).getUser();
       
        WebForward webForward = null;
        try {
            try {
                Calendar now = Calendar.getInstance();

                if (type == WebForward.TYPE_TUNNELED_SITE) {
                    com.adito.webforwards.TunneledSiteWebForward sswf = new com.adito.webforwards.TunneledSiteWebForward(user.getRealm().getRealmID(),
                                    -1, destinationURL, name, description, category, autoStart, now, now);
                    webForward = WebForwardDatabaseFactory.getInstance().createWebForward(sswf);
                    CoreEvent evt = new ResourceChangeEvent(this, WebForwardEventConstants.CREATE_WEB_FORWARD, webForward, this
                                    .getSessionInfo(request), CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_CATEGORY, webForward.getCategory()).addAttribute(
                                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(webForward.getType())).getName()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, webForward.getDestinationURL());
                    CoreServlet.getServlet().fireCoreEvent(evt);
                } else if (type == WebForward.TYPE_REPLACEMENT_PROXY) {
                    com.adito.webforwards.ReplacementProxyWebForward spwf = new com.adito.webforwards.ReplacementProxyWebForward(user.getRealm().getRealmID(),
                                    -1, destinationURL, name, description, category, authenticationUsername,
                                    authenticationPassword, preferredAuthenticationScheme, encodeing, restrictToHosts, formType,
                                    formParameters, autoStart, now, now);

                    AbstractAuthenticatingWebForward abstractAuthenticatingWebForward = (AbstractAuthenticatingWebForward) WebForwardDatabaseFactory
                                    .getInstance().createWebForward(spwf);
                    CoreEvent evt = new ResourceChangeEvent(this, WebForwardEventConstants.CREATE_WEB_FORWARD, abstractAuthenticatingWebForward, this
                                    .getSessionInfo(request), CoreEvent.STATE_SUCCESSFUL).addAttribute(
                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_CATEGORY, abstractAuthenticatingWebForward.getCategory()).addAttribute(
                                                                    WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_TYPE,
                        ((WebForwardTypeItem) WebForwardTypes.WEB_FORWARD_TYPES.get(abstractAuthenticatingWebForward.getType())).getName()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_URL, abstractAuthenticatingWebForward.getDestinationURL()).addAttribute(
                                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_PREFERED_AUTH_SCHEME,
                        abstractAuthenticatingWebForward.getPreferredAuthenticationScheme()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_USERNAME,
                        abstractAuthenticatingWebForward.getAuthenticationUsername()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_FORM_TYPE,
                        abstractAuthenticatingWebForward.getFormType()).addAttribute(
                                        WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_WEB_FORWARD_ENCODEING, spwf.getEncoding());

                    spwf.addFormParametersToEvent(evt, WebForwardEventConstants.EVENT_ATTR_WEB_FORWARD_AUTH_FORM_PARAMETERS);
                    spwf
                                    .addRestrictToHostsToEvent(evt,
                                                    WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_WEB_FORWARD_RESTRICT_TO_HOSTS);
                    CoreServlet.getServlet().fireCoreEvent(evt);
                    webForward = abstractAuthenticatingWebForward;
                } else if (type == WebForward.TYPE_PATH_BASED_REVERSE_PROXY || type == WebForward.TYPE_HOST_BASED_REVERSE_PROXY) {
                    com.adito.webforwards.ReverseProxyWebForward rpwf = new com.adito.webforwards.ReverseProxyWebForward(user.getRealm().getRealmID(),
                                    -1, type, destinationURL, name, description, category, authenticationUsername,
                                    authenticationPassword, preferredAuthenticationScheme, formType, formParameters, paths,
                                    hostHeader, activeDNS, autoStart, now, now, encodeing);
                    AbstractAuthenticatingWebForward abstractAuthenticatingWebForward = (AbstractAuthenticatingWebForward) WebForwardDatabaseFactory
                                    .getInstance().createWebForward(rpwf);
View Full Code Here

            UserDatabase udb = (UserDatabase) seq.getAttribute(SelectUserDatabaseForm.ATTR_USER_DATABASE_INSTANCE, null);
            if (!udb.isOpen()) {
                udb.open(CoreServlet.getServlet(), udb.getRealm());
            }

            User user = null;
            try {
                /*
                 * Try and get the super user. If an exception occurs we assume
                 * it doesn't exist and so try to create, otherwise it is
                 * updated
                 */

                user = udb.getAccount(superUser);
                resetUser(request, user);

                /*
                 * The super exists so just update it
                 */
                if (isSuperUserCreationSupported(udb)) {
                    // (Probably) Already exists, just update
                    udb.updateAccount(user, email, user.getFullname(), user.getRoles());
                    l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.superUserUpdated"));
                }
            } catch (Exception unfe) {
                if (isSuperUserCreationSupported(udb)) {
                    udb.createAccount(superUser, superUserPassword, email, "Super User", new Role[] {});
                    l.add(new WizardActionStatus(WizardActionStatus.COMPLETED_OK, "installation.install.status.superUserCreated"));
                    user = udb.getAccount(superUser);
                    resetUser(request, user);
                }
            }

            Property.setProperty(new RealmKey("security.administrators", user.getRealm().getResourceId()), superUser, seq
                            .getSession());

            /*
             * Set the super user password
             */
 
View Full Code Here

     */
    @Test
    public void checkAllAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createAllAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

     */
    @Test
    public void checkNoAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createAllAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

     */
    @Test
    public void checkDeleteAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createDeleteAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

     */
    @Test
    public void checkCreateEditAssignAssignAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createCreateEditAssignAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

    @Test
    public void checkEditAssignAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        int users = getDefaultUserDatabase().listAllUsers(UserDatabase.WILDCARD_SEARCH, Integer.MAX_VALUE).length ;
        User user = createAccount();
        assertEquals(getDefaultUserDatabase().listAllUsers(UserDatabase.WILDCARD_SEARCH, Integer.MAX_VALUE).length, users +1);
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createEditAssignAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
View Full Code Here

     */
    @Test
    public void checkAssignAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
        Policy policy = createPolicy(realm);
        User user = createAccount();
        getPolicyService().grantPolicyToPrincipal(policy, user);
        AccessRights accessRights = createAssignAccessRights(getResourceType().getPermissionClass());
        PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

     */
    @Test
    public void checkResourceAccessRights() throws Exception {
        Realm realm = getDefaultRealm();
      Policy policy = createPolicy(realm);
      User user = createAccount();
      getPolicyService().grantPolicyToPrincipal(policy, user);
      AccessRights accessRights = createAssignAccessRights(getResourceType().getPermissionClass());
      PropertyList selectedPolicies = PropertyList.createFromArray(new int[] {policy.getResourceId()});
        PolicyDatabaseFactory.getInstance().attachResourceToPolicyList(accessRights, selectedPolicies, getSessionInfo());
       
View Full Code Here

TOP

Related Classes of com.adito.security.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.