<%@ page import="sun.misc.*" %> <%! public void m1(HttpServletResponse res) { res.setStatus(401); res.setHeader("WWW-Authenticate","BASIC realmname=enter username and password"); } %> <% String s=request.getHeader("Authorization"); if(s !=null) { String encodeddata =s.substring(6); BASE64Decoder obj=new BASE64Decoder(); String up=new String(obj.decodeBuffer(encodeddata)); String [] arr=up.split(":"); if(arr[0].equals("ad") && arr[1].equals("ad") ) { out.println("Welcome to the page" ); } else { m1(response); } } else { m1(response); } %>
Example of Programatic Security
05
Apr