hi bruno thank you!
In android I used the example of the cookbook and it worked
the server try to use the example of jaxrs and I could not
try using aerogear-security-shiro and could not,
have an equal jaxrs example but using shiro?
infos:
i use android native in client and jboss7.1(ejb jpa resteasy jdk6 jee6) in
server
database of users and profile and data, I seek a REST/JSON in a tomcat 5
(legacy system)
sample sequence:
>>>>>>>>>android native send aerogear login
<<<<<<<<
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.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);
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
authModule.login("jhon", "123", new
AbstractActivityCallback<HeaderAndBody>() {
}
>>>>>>>>server receive
<<<<<<<<<<<
(is my problem ) (wanted an example
here )(queria um exemplo disso aqui no
shiro )
@Path("/auth")
public class LoginEndpoint {
private static final Logger LOGGER =
Logger.getLogger(LoginEndpoint.class.getSimpleName());
// @Inject
private AuthenticationManager authenticationManager;
@POST
@Path("/login")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response login(User simpleUser) {
User user = new User(simpleUser.getUsername(),
simpleUser.getPassword());
authenticationManager.login(user, simpleUser.getPassword());
//return simpleUser;
return Response.status(Status.OK).entity(user).build();
}
>>>>>>>>>>>>>> android
receive <<<<<<<<<<<<<<<<<<
@Override
public void onSuccess(HeaderAndBody data) {
Log.d(LOG_TAG, "Received ID: " + data.toString() );
logged(true);
Toast.makeText(getActivity(), "logado",
Toast.LENGTH_SHORT).show();
}
---------(as the android saves login, as he knows that this logged? need
sample) -------
>>>>>>>>>>>>>>> android
send next requisition <<<<<<<<<<
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<pessoaVO> pipes =
pipeline.get("pessoavo", mContext);
pipes.read(readCallback);
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;
}
---------next pipe in login? how call security rest? necessary is send login
again? -------
>>>>>>>>>>>>>>server
received and response<<<<<<<<<<
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response listar();
--------how use @secure("admin)? -------- is necessary a sample -----
>>>>>>>>>>>>>>>the
end<<<<<<<<<<<<<<<<<<
--
View this message in context:
http://aerogear-dev.1069024.n5.nabble.com/aerogear-security-and-android-t...
Sent from the aerogear-dev mailing list archive at
Nabble.com.