List of usage examples for javax.naming AuthenticationException AuthenticationException
public AuthenticationException(String explanation)
From source file:org.wso2.security.tools.zap.ext.zapwso2jiraplugin.JiraRestClient.java
/** * This method is for getting any Jira related details * @param auth -Base64 encoded value of Jirausername and JiraPassword * @param url- Jira Base URL//from w ww.j a v a 2s . c o m * @return */ public static String invokeGetMethod(String auth, String url) throws AuthenticationException, ClientHandlerException { Client client = Client.create(); WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").get(ClientResponse.class); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } else if (statusCode == HttpStatus.SC_FORBIDDEN) { throw new AuthenticationException("Forbidden"); } return response.getEntity(String.class); }
From source file:org.zaproxy.zap.extension.zapwso2jiraplugin.JiraRestClient.java
public static String invokeGetMethod(String auth, String url) throws AuthenticationException, ClientHandlerException { Client client = Client.create();/*from www . jav a 2 s .c o m*/ WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").get(ClientResponse.class); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } else if (statusCode == HttpStatus.SC_FORBIDDEN) { throw new AuthenticationException("Forbidden"); } return response.getEntity(String.class); }
From source file:org.wso2.security.tools.zap.ext.zapwso2jiraplugin.JiraRestClient.java
/** * This method is for creating Jira related details * @param auth -Base64 encoded value of Jirausername and JiraPassword * @param url- Jira Base URL/*from w w w. j a va 2s .c om*/ * @return */ public static String invokePostMethod(String auth, String url, String data) throws AuthenticationException, ClientHandlerException { Client client = Client.create(); WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").post(ClientResponse.class, data); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } return response.getEntity(String.class); }
From source file:edu.vt.middleware.ldap.handler.CompareAuthorizationHandler.java
/** {@inheritDoc} */ public void process(final AuthenticationCriteria ac, final LdapContext ctx) throws NamingException { // make DN the first filter arg final List<Object> filterArgs = new ArrayList<Object>(); filterArgs.add(ac.getDn());//from ww w . j a va2 s. c om filterArgs.addAll(this.searchFilter.getFilterArgs()); // perform ldap compare operation NamingEnumeration<SearchResult> results = null; try { results = ctx.search(ac.getDn(), this.searchFilter.getFilter(), filterArgs.toArray(), LdapConfig.getCompareSearchControls()); if (!results.hasMore()) { throw new AuthenticationException("Compare failed"); } } finally { if (results != null) { results.close(); } } }
From source file:org.wso2.security.tools.scanner.dependency.js.ticketcreator.JIRARestClient.java
/** * Invoke Get method/*from w w w. j a v a 2s . c om*/ * * @param auth credentials info of JIRA * @param url url to be invoked. * @return response entity of get method. * @throws AuthenticationException Exception occurred while authenticate the JIRA */ public String invokeGetMethod(String auth, String url) throws AuthenticationException { Client client = Client.create(); WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").get(ClientResponse.class); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } else if (statusCode == HttpStatus.SC_FORBIDDEN) { throw new AuthenticationException("Forbidden"); } return response.getEntity(String.class); }
From source file:org.zaproxy.zap.extension.zapwso2jiraplugin.JiraRestClient.java
public static String invokePostMethod(String auth, String url, String data) throws AuthenticationException, ClientHandlerException { Client client = Client.create();//from w w w . ja v a 2 s. c o m WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").post(ClientResponse.class, data); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } return response.getEntity(String.class); }
From source file:org.wso2.security.tools.zap.ext.zapwso2jiraplugin.JiraRestClient.java
/** * This is is for modifying a ticket/*from w w w .j a v a 2 s . co m*/ * @param auth -Base64 encoded value of Jirausername and JiraPassword * @param url- Jira Base URL * @param url- data need to be added as a comment * @return */ public static String invokePutMethod(String auth, String url, String data) throws AuthenticationException, ClientHandlerException { Client client = Client.create(); WebResource webResource = client.resource(url); WebResource.Builder builder = webResource.header("Authorization", "Basic " + auth); builder = builder.type("application/json"); builder = builder.accept("application/json"); ClientResponse response = builder.post(ClientResponse.class, data); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } return response.getEntity(String.class); }
From source file:org.zaproxy.zap.extension.zapwso2jiraplugin.JiraRestClient.java
public static String invokePostComment(String auth, String url, String data) throws AuthenticationException, ClientHandlerException { Client client = Client.create();/*from w ww. ja va 2 s . c o m*/ WebResource webResource = client.resource(url); WebResource.Builder builder = webResource.header("Authorization", "Basic " + auth); builder = builder.type("application/json"); builder = builder.accept("application/json"); ClientResponse response = builder.post(ClientResponse.class, data); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } return response.getEntity(String.class); }
From source file:org.wso2.security.tools.scanner.dependency.js.ticketcreator.JIRARestClient.java
/** * Invoke Post Method to create issue Ticket. * * @param auth credentials info of JIRA/* w w w. j av a 2s .c o m*/ * @param url url to be invoked. * @param data data of API call. * @return response entity. * @throws AuthenticationException Exception occurred while authenticate the JIRA. */ public String invokePostMethod(String auth, String url, String data) throws AuthenticationException { Client client = Client.create(); WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").post(ClientResponse.class, data); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } return response.getEntity(String.class); }
From source file:org.wso2.security.tools.zap.ext.zapwso2jiraplugin.JiraRestClient.java
/** * This Method is for deleting Jira/attachments in ticket * @param auth -Base64 encoded value of Jirausername and JiraPassword * @param url- Jira Base URL/* w w w. j a v a 2s .c o m*/ * @return */ public static void invokeDeleteMethod(String auth, String url) throws AuthenticationException, ClientHandlerException { Client client = Client.create(); WebResource webResource = client.resource(url); ClientResponse response = webResource.header("Authorization", "Basic " + auth).type("application/json") .accept("application/json").delete(ClientResponse.class); int statusCode = response.getStatus(); if (statusCode == HttpStatus.SC_UNAUTHORIZED) { throw new AuthenticationException("Invalid Username or Password"); } }