Class BasicAuthentication
- java.lang.Object
-
- net.sourceforge.jbizmo.commons.authentication.BasicAuthentication
-
public class BasicAuthentication extends Object
Utility class for HTTP basic access authentication
Copyright 2018 (C) by Martin Ganserer
- Version:
- 1.0.0
- Author:
- Martin Ganserer
-
-
Field Summary
Fields Modifier and Type Field Description static StringHTTP_HEADER_AUTHORIZATION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcreateAuthentication(String userName, String password)Create a basic authentication string by using the provided credentialsstatic StringgetPassword(String authenticationString)Extract the password from the given authentication stringstatic StringgetUserName(String authenticationString)Extract the user name from the given authentication string
-
-
-
Field Detail
-
HTTP_HEADER_AUTHORIZATION
public static final String HTTP_HEADER_AUTHORIZATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
createAuthentication
public static String createAuthentication(String userName, String password)
Create a basic authentication string by using the provided credentials- Parameters:
userName-password-- Returns:
- the authentication string
-
getUserName
public static String getUserName(String authenticationString)
Extract the user name from the given authentication string- Parameters:
authenticationString-- Returns:
- the user name
- Throws:
IllegalArgumentException- if the authentication string is either empty or if it has an illegal format
-
getPassword
public static String getPassword(String authenticationString)
Extract the password from the given authentication string- Parameters:
authenticationString-- Returns:
- the password
- Throws:
IllegalArgumentException- if the authentication string is either empty or if it has an illegal format
-
-