Package org.jboss.security.client

Examples of org.jboss.security.client.SecurityClient.login()


        final SingletonSecurity securedSingleton = InitialContext.doLookup("java:module/" + SecuredSingletonBean.class.getSimpleName());
        final SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
        securityClient.setSimple("user1", "password1");
        try {
            // login
            securityClient.login();
            // expects role1, so should succeed
            securedSingleton.allowedForRole1();
        } finally {
            securityClient.logout();
        }
View Full Code Here


        final SingletonSecurity securedSingleton = InitialContext.doLookup("java:module/" + SecuredSingletonBean.class.getSimpleName());
        final SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
        securityClient.setSimple("user2", "password2");
        try {
            // login
            securityClient.login();
            try {
                // expects role1, so should fail
                securedSingleton.allowedForRole1();
                Assert.fail("Call to secured method, with incorrect role, was expected to fail");
            } catch (EJBAccessException ejbae) {
View Full Code Here

        try {
            InitialContext ctx = new InitialContext();

            client = SecurityClientFactory.getSecurityClient();
            client.setSimple("user1", "password1");
            client.login();

            injectedSession.hello();
            injectedSession.goodbye();

            injectedStateless.hello();
View Full Code Here

        try {
            InitialContext ctx = new InitialContext();

            client = SecurityClientFactory.getSecurityClient();
            client.setSimple("user1", "password1");
            client.login();

            injectedSession.hello();
            injectedSession.goodbye();

            injectedStateless.hello();
View Full Code Here

    @Test
    public void testJackInABox() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        try {
            WhoAmI bean =  lookupCallerWithIdentity();
            String actual = bean.getCallerPrincipal();
            Assert.assertEquals("jackinabox", actual);
        } finally {
View Full Code Here

    @Test
    public void testSingletonPostconstructSecurity() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        try {
            WhoAmI bean = lookupSingleCallerWithIdentity();
            String actual = bean.getCallerPrincipal();
            Assert.assertEquals("Helloween", actual);
        } finally {
View Full Code Here

    @Test
    public void testAnonymous() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        try {
            WhoAmI bean = lookupCaller();
            String actual = bean.getCallerPrincipal();
            Assert.assertEquals("anonymous", actual);
        } finally {
View Full Code Here

    @Test
    public void testSingletonPostconstructSecurityNotPropagating() throws Exception {
        SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        try {
            WhoAmI bean = lookupSingletonUseBeanWithIdentity(); //To load the singleton
            bean.getCallerPrincipal();
            Assert.fail("Deployment should fail");
        } catch (Exception dex) {
View Full Code Here

    }

    private SecurityClient login() throws Exception {
        final SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        return client;
    }

    @Test
    public void testStatelessLifecycle() throws Exception {
View Full Code Here

    @Test
    public void testAuthenticatedCall() throws Exception {
        // TODO: this is not spec
        final SecurityClient client = SecurityClientFactory.getSecurityClient();
        client.setSimple("user1", "password1");
        client.login();
        try {
            try {
                final Principal principal = whoAmIBean.getCallerPrincipal();
                assertNotNull("EJB 3.1 FR 17.6.5 The container must never return a null from the getCallerPrincipal method.",
                        principal);
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.