Mechanizm autentykacji glassfish Realm

0

Czy istnieje możliwość wysłania żądania np z POSTMANA do servletu, tak aby servlet przetworzył to żadanie. Bo na chwile obecna, dostaje informację abym się zautentykować??

Pozdrawiam,
Czosnek

0

Chcę wystawić web-api, do istniejącej strony. Normalnie mechanizm autoryzacji jest przez formularz na stronie.
Natomiast próbuje przez postmana wysłać żąanie z autoryzacją(digest auth) :
Login :login
Passwod: pass
Realm: securityRealm
Algorithm: MD5.

Natomiast cały czas, dostaję zwrotkę w postaci formularza logowania :(

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">

    <session-config>
        <session-timeout>
            30
        </session-timeout>
        <tracking-mode>COOKIE</tracking-mode>
   </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <listener>
        <listener-class>
            utils.DBConfig
        </listener-class>
    </listener>

    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>securityRealm</realm-name>
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/error.jsp</form-error-page>
        </form-login-config>
    </login-config>

    <security-constraint>
        <web-resource-collection>
                <web-resource-name>Authorization Mechanism</web-resource-name>
                <url-pattern>/resources/*</url-pattern>
                <http-method>POST</http-method>
                <http-method>GET</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>user</role-name>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>
</web-app>

----WEB API-----------

package webservice;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

@ApplicationPath("resources")
public class JAXRSConfiguration extends Application {

}
package webservice;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

@Path("api")
public class DeveloperResources {

    @GET
    @Path("developer/{name}")
    public String deleloper(@PathParam("name") String name) {
        return "Your's service: " + name;
    }

}

1 użytkowników online, w tym zalogowanych: 0, gości: 1