Examples of SubjectInfo


Examples of org.apache.geronimo.security.deploy.SubjectInfo

    }

    private SubjectInfo buildSubjectInfo(GerSubjectInfoType defaultSubject) {
        String realmName = defaultSubject.getRealm().trim();
        String id = defaultSubject.getId().trim();
        return new SubjectInfo(realmName, id);
    }
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

                String roleName = roleType.getRoleName().trim();
                role.setRoleName(roleName);

                if (roleType.isSetRunAsSubject()) {
                    SubjectInfo subjectInfo = buildSubjectInfo(roleType.getRunAsSubject());
                    security.getRoleSubjectMappings().put(roleName, subjectInfo);
                }

                for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
                    role.getRealmPrincipals().add(GeronimoSecurityBuilderImpl.buildRealmPrincipal(roleType.getRealmPrincipalArray(j)));
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

        if (defaultSubject == null) {
            return null;
        }
        String realmName = defaultSubject.getRealm().trim();
        String id = defaultSubject.getId().trim();
        return new SubjectInfo(realmName, id);
    }
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

        Security securityConfig = new Security();
        securityConfig.setUseContextHandler(false);

        String securityRealmName = "demo-properties-realm";
        String defaultPrincipalId = "izumi";
        SubjectInfo defaultSubjectInfo = new SubjectInfo(securityRealmName, defaultPrincipalId);
        securityConfig.setDefaultSubjectInfo(defaultSubjectInfo);

        Role role = new Role();
        role.setRoleName("content-administrator");
        PrincipalInfo principalInfo = new PrincipalInfo("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal", "it");
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

        Security securityConfig = new Security();
        securityConfig.setUseContextHandler(false);

        String securityRealmName = "demo-properties-realm";
        String defaultPrincipalId = "izumi";
        SubjectInfo defaultSubjectInfo = new SubjectInfo(securityRealmName, defaultPrincipalId);
        securityConfig.setDefaultSubjectInfo(defaultSubjectInfo);

        Role role = new Role();
        role.setRoleName("content-administrator");
        PrincipalInfo principalInfo = new PrincipalInfo("org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal", "it");
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

                    if (realmName != null) {
                        appClientContainerGBeanData.setAttribute("realmName", realmName);
                        appClientContainerGBeanData.setAttribute("callbackHandlerClassName", callbackHandlerClassName);
                    } else if (geronimoAppClient.isSetDefaultSubject()) {
                        GerSubjectInfoType subjectInfoType = geronimoAppClient.getDefaultSubject();
                        SubjectInfo subjectInfo = buildSubjectInfo(subjectInfoType);
                        appClientContainerGBeanData.setAttribute("defaultSubject", subjectInfo);
                        appClientContainerGBeanData.setReferencePattern("CredentialStore", credentialStoreName);
                    } else if (earContext.getSecurityConfiguration() != null) {
                        //beware a linkage error if we cast this to SubjectInfo
                        String realm = ((SecurityConfiguration) earContext.getSecurityConfiguration()).getDefaultSubjectRealm();
                        String id = ((SecurityConfiguration) earContext.getSecurityConfiguration()).getDefaultSubjectId();
                        if (realm != null) {
                            SubjectInfo subjectInfo = new SubjectInfo(realm, id);
                            appClientContainerGBeanData.setAttribute("defaultSubject", subjectInfo);
                            appClientContainerGBeanData.setReferencePattern("CredentialStore", credentialStoreName);
                        }
                    }
                    appClientContainerGBeanData.setReferencePattern("JNDIContext", jndiContextName);
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

    }

    private SubjectInfo buildSubjectInfo(GerSubjectInfoType defaultSubject) {
        String realmName = defaultSubject.getRealm().trim();
        String id = defaultSubject.getId().trim();
        return new SubjectInfo(realmName, id);
    }
View Full Code Here

Examples of org.apache.geronimo.security.deploy.SubjectInfo

            registerSubject(defaultSubject);
        }

        for (Map.Entry<String, SubjectInfo> entry : roleDesignates.entrySet()) {
            String role = entry.getKey();
            SubjectInfo subjectInfo = entry.getValue();
            if (subjectInfo == null || credentialStore == null) {
                throw new NullPointerException("No subjectInfo for role " + role);
            }
            Subject roleDesignate = credentialStore.getSubject(subjectInfo.getRealm(), subjectInfo.getId());
            registerSubject(roleDesignate);
            this.roleDesignates.put(role, roleDesignate);
        }
    }
View Full Code Here

Examples of org.jboss.security.SubjectInfo

  @Override
  public Subject getSubjectInContext(String securityDomain) {
    SecurityContext sc = SecurityActions.getSecurityContext();
    if (sc != null && sc.getSecurityDomain().equals(securityDomain)) {
      SubjectInfo si = sc.getSubjectInfo();
      Subject subject = si.getAuthenticatedSubject();
      return subject;
    }   
    return null;
  }
View Full Code Here

Examples of org.jboss.security.SubjectInfo

        }
    }

    private boolean authenticate(SecurityContext context) {
        SecurityContextUtil util = context.getUtil();
        SubjectInfo subjectInfo = context.getSubjectInfo();
        Subject subject = new Subject();
        Principal principal = util.getUserPrincipal();
        Object credential = util.getCredential();

        boolean authenticated = false;
        if (principal == null) {
            Identity unauthenticatedIdentity = getUnauthenticatedIdentity();
            subjectInfo.addIdentity(unauthenticatedIdentity);
            subject.getPrincipals().add(unauthenticatedIdentity.asPrincipal());
            authenticated = true;
        }

        if (authenticated == false) {
            AuthenticationManager authenticationManager = context.getAuthenticationManager();
            authenticated = authenticationManager.isValid(principal, credential, subject);
        }
        if (authenticated == true) {
            subjectInfo.setAuthenticatedSubject(subject);
        }

        return authenticated;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.