Package com.dodo.blog.model

Examples of com.dodo.blog.model.Account


    }

    @GetModel( name = REGISTRATION_FORM )
    public Account getModel()
    {
        return new Account();
    }
View Full Code Here


    }

    @Override
    public AuthUser getAuthUserById( String authUserId )
    {
        Account account = datastore.find( Account.class, Long.valueOf( authUserId ) );

        if ( account == null )
        {
            log.info( "Account not found for id: " + authUserId );
        }
View Full Code Here

    {
        Authorized authorizedRoles = ( Authorized ) clazz.getAnnotation( Authorized.class );
        boolean isAuthorized = false;
        if ( authorizedRoles != null )
        {
            Account account = WebApplication.get().getLoggedInAccount();
            if ( account != null )
            {
                for ( Role role : authorizedRoles.roles() )
                {
                    if ( account.getRole() == role )
                    {
                        isAuthorized = true;
                        break;
                    }
                }
View Full Code Here

    }

    @Override
    public AuthUser authenticate( SessionUser sessionUser ) throws AuthenticatedException
    {
        Account account = null;

        switch ( sessionUser.getLoginType() )
        {
            case OAUTH:
            case OPEN_ID:
View Full Code Here

    public UserInfoPanel()
    {
        setClassName( "user-info-panel" );

        WebApplication webApplication = WebApplication.get();
        Account account = webApplication.getLoggedInAccount();
        if ( account != null )
        {
            Anchor link = new Anchor( account.getUserInfo(), MyAccount.class );
            add( link );
        }
        else
        {
            add( new Span( localize(
View Full Code Here

    public void testRegisterEmailAccount()
    {
        // register email account
        try
        {
            Account account = registerEmailAccount();
            Assert.assertEquals( "pohorelecjozef@gmail.com", account.getEmail() );
        }
        catch ( Exception e )
        {
            Assert.fail( "This exception should not be thrown: " + e );
        }
View Full Code Here

    public void testRegisterLoginAccount()
    {
        // register login account
        try
        {
            Account account = registerLoginAccount();
            Assert.assertEquals( "dodo", account.getLogin() );
            Assert.assertEquals( "b59c67bf196a4758191e42f76670ceba", account.getPassword() );
        }
        catch ( Exception e )
        {
            Assert.fail( "This exception should not be thrown: " + e );
        }
View Full Code Here

        }
    }

    private Account registerEmailAccount() throws EmailAlreadyExists, LoginAlreadyExists
    {
        Account account = new Account();
        account.setLoginType( LoginType.OPEN_ID );
        account.setEmail( "pohorelecjozef@gmail.com" );

        accountService.register( account );
        return account;
    }
View Full Code Here

        return account;
    }

    private Account registerLoginAccount() throws EmailAlreadyExists, LoginAlreadyExists
    {
        Account account = new Account();
        account.setLoginType( LoginType.LOGIN );
        account.setLogin( "dodo" );
        account.setPassword( "1111" );

        accountService.register( account );
        return account;
    }
View Full Code Here

    private AccountService accountService;

    @Test
    public void testAuthenticateEmailAccount()
    {
        Account account = new Account();
        account.setLoginType( LoginType.OPEN_ID );
        account.setEmail( "pohorelecjozef@gmail.com" );
        accountService.saveAccount( account );

        SessionUser sessionUser = new SessionUser();
        sessionUser.setEmail( account.getEmail() );
        sessionUser.setLoginType( LoginType.OPEN_ID );

        try
        {
            Account authorizedAccount = ( Account ) authService.authenticate( sessionUser );
            Assert.assertEquals( "pohorelecjozef@gmail.com", authorizedAccount.getEmail() );
        }
        catch ( AuthenticatedException e )
        {
            Assert.fail( "This exception should not be thrown: " + e );
        }
View Full Code Here

TOP

Related Classes of com.dodo.blog.model.Account

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.