[aerogear-dev] aerogear security and android

Bruno Oliveira bruno at abstractj.org
Tue Mar 11 07:52:46 EDT 2014


Good morning Marcelo, I’m not an Android specialist or anything, but speaking about AeroGear. The team worked to keep the symmetry between the APIs, so it doesn’t matter which backend do you have.

I couldn’t understand what do you mean by "authorize cripty token push”. To make use of REST, take a look at the Android cookbook (https://github.com/aerogear/aerogear-android-cookbook), more specifically https://github.com/aerogear/aerogear-android-cookbook/tree/5c0aa9d1434a239a2e184573b338b73732e7cea1/src/org/jboss/aerogear/cookbook/authentication. In addition check our documentation at https://aerogear.org

Regarding which server should you use. The answer is whatever you want, our clients are not tied to JBoss.

Speaking about the server not be functional, we are open for suggestions or send patches. Currently the following projects are running the authentication bits with no problems:

- https://github.com/aerogear/aerogear-jaxrs-demohttps://github.com/aerogear/aerogear-integration-tests-serverhttps://github.com/aerogear/aerogear-unifiedpush-server

But if something is missing or not working, I’m open for suggestions.

--  
abstractj

On March 10, 2014 at 1:28:33 PM, marceloheck (marceloheck at gmail.com) wrote:
> Hello
>  
> I search a sample with aerogear and security server
>  
> in client
>  
> private AuthenticationModule authModule;
> private String baseURL = "http://localhost:8080/servicos/service/auth";
>  
> private TextView status;
> private Button login;
> private Button logout;
> private static final String LOG_TAG = login.class.getName();
>  
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.activity_main);
>  
> Authenticator authenticator = new Authenticator(baseURL);
> AuthenticationConfig authenticationConfig = new
> AuthenticationConfig();
> // authenticationConfig.setAuthType(AuthTypes.HTTP_BASIC);
> authenticationConfig.setLoginEndpoint("/login");
> authenticationConfig.setLogoutEndpoint("/logout");
> authModule = authenticator.auth("login", authenticationConfig);
>  
> status = (TextView) findViewById(R.id.editText1);
> login = (Button) findViewById(R.id.button1);
> logout = (Button) findViewById(R.id.Button01);
>  
> button = (Button) findViewById(R.id.button1);
>  
> /* // Capture button clicks
> button.setOnClickListener(new OnClickListener() {
> public void onClick(View arg0) {
>  
> // Start NewActivity.class
> Intent myIntent = new Intent(MainActivity.this,
> login.class);
> startActivity(myIntent);
> }
> });*/
>  
> login.setOnClickListener(new View.OnClickListener() {
> @Override
> public void onClick(View view) {
> authModule.login("nome", "senha", new
> AbstractActivityCallback() {
>  
>  
> @Override
> public void onSuccess(HeaderAndBody data) {
> Log.d(LOG_TAG, "Received ID: " + data.toString() );
> logged(true);
> // Start NewActivity.class
> Intent myIntent = new Intent(MainActivity.this,
>  
> br.gov.pr.dc.sisdc.activities.MapActivity.class);
> startActivity(myIntent);
>  
> // Toast.makeText(getActivity(), "logado",
> Toast.LENGTH_SHORT).show();
> }
>  
> @Override
> public void onFailure(Exception e) {
> displayError(e.getMessage());
> // Toast.makeText(getActivity(), "erro",
> Toast.LENGTH_SHORT).show();
> Log.d(LOG_TAG, "error: " + e );
> Intent myIntent = new Intent(MainActivity.this,
>  
> br.gov.pr.dc.sisdc.activities.MapActivity.class);
> startActivity(myIntent);
> }
> });
> }
> });
>  
>  
> is ok
>  
> but how to use the rest in android is authenticate and authorize cripty
> token push etc... in other REST service?
> is session? is value how?
>  
> ...
>  
> URL BASE_URL = new URL("http://localhost:8080/servicos/service/");
>  
> PageConfig pageConfig = new PageConfig();
> pageConfig.setLimitValue(5);
> pageConfig.setMetadataLocation(PageConfig.MetadataLocations.WEB_LINKING);  
>  
> PipeConfig pipeConfig = new PipeConfig(BASE_URL, AbrigoVO.class);
> pipeConfig.setEndpoint("pessoa");
> pipeConfig.setPageConfig(pageConfig);
> pipeline = new Pipeline(BASE_URL);
> pipeline.pipe(pessoaVO.class, pipeConfig);
>  
> LoaderPipe pipes = pipeline.get("pessoavo", mContext);
> //LoaderPipe pipes = this.pipeline.get("pessoavo", fragment,
> mContext);
>  
> //TODO
> https://github.com/aerogear/aerogear-aerodoc-android/blob/master/src/org/jboss/aerogear/android/unifiedpush/aerodoc/fragments/AeroDocLeadsAvailableFragments.java  
> pipes.read(readCallback);
>  
> Log.d(LOG_TAG, "Received ID: " );
> return null;
> } catch (Exception e) {
> // TODO Need error handling
> Log.e(LOG_TAG, e.getLocalizedMessage(), e);
> Log.e(LOG_TAG, "sem serviço", e);
> e.printStackTrace();
> return null;
> }
> ...
>  
>  
>  
>  
>  
> and security server jboss 7 ??
>  
>  
>  
>  
> @Path("/pessoa/")
> public interface pessoaResource {
>  
> @Produces(MediaType.APPLICATION_JSON)
> public Response listar();
>  
>  
> @GET
> @Path("/{codigo}")
> @Produces(MediaType.APPLICATION_JSON)
> public Response obter(@PathParam("codigo") Long idpessoa);
>  
> }
>  
>  
> i add
>  
> @Inject
> private IdentityManagement configuration;
>  
> @Inject
> private AuthenticationManager authenticationManager;
>  
> and
>  
>  
> org.jboss.aerogear.security.interceptor.SecurityInterceptor  
>  
>  
> and
>  
> @Secure("admin")
>  
> but error injection
>  
> WELD-001408 Unsatisfied dependencies for type [EntityManager] with
> qualifiers [@Default] at injection point [[field] @Inject private
> org.jboss.aerogear.security.shiro.authz.GrantConfiguration.entityManager]  
>  
> examples JaxRS and shiro and demo not funcional of soluction server and
> client android
>  
> i connect database login password e groups for login
>  
> how to keep the connected User? have database or saved in the session?
>  
> can someone give me a practical example for using rest client server?
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  
> --
> View this message in context: http://aerogear-dev.1069024.n5.nabble.com/aerogear-security-and-android-tp6703.html  
> Sent from the aerogear-dev mailing list archive at Nabble.com.
>  
> _______________________________________________
> aerogear-dev mailing list
> aerogear-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-dev




More information about the aerogear-dev mailing list