Class OkHttpTokenizeLogin
-
- All Implemented Interfaces:
-
pro.fessional.wings.slardar.httprest.okhttp.OkHttpTokenClient.Tokenize
public class OkHttpTokenizeLogin implements OkHttpTokenClient.Tokenize
Traditional Post-Form Login
- Since:
2022-11-26
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public StringkeyUsernamepublic StringkeyPasswordpublic StringkeyTokenpublic StringloginUrlpublic Stringusernamepublic Stringpasswordpublic StringheaderAuthpublic StringheaderAcceptpublic StringheaderUserAgentpublic transient Stringtokenpublic transient Consumer<String>initListener
-
Constructor Summary
Constructors Constructor Description OkHttpTokenizeLogin()
-
Method Summary
Modifier and Type Method Description StringgetKeyUsername()Parameter name of username. voidsetKeyUsername(String keyUsername)Parameter name of username. StringgetKeyPassword()Parameter name of password. voidsetKeyPassword(String keyPassword)Parameter name of password. StringgetKeyToken()The key used when parsing the token, which by default is equal to headerAuth voidsetKeyToken(String keyToken)The key used when parsing the token, which by default is equal to headerAuth StringgetLoginUrl()Url to login voidsetLoginUrl(String loginUrl)Url to login StringgetUsername()login username voidsetUsername(String username)login username StringgetPassword()login password voidsetPassword(String password)login password StringgetHeaderAuth()Set the header name of token. voidsetHeaderAuth(String headerAuth)Set the header name of token. StringgetHeaderAccept()voidsetHeaderAccept(String headerAccept)StringgetHeaderUserAgent()voidsetHeaderUserAgent(String headerUserAgent)StringgetToken()voidsetToken(String token)Consumer<String>getInitListener()voidsetInitListener(Consumer<String> initListener)booleanneedToken(@NotNull() Request request)Whether to need token booleanfillToken(Request.Builder builder)Set a valid token, usually in the header. booleaninitToken(@NotNull() Call.Factory callFactory)try init token booleanisCookieAuto()Whether to use auto cookie mode, default false. voidsetCookieAuto(boolean cookieAuto)Whether to use auto cookie mode, default false. -
-
Method Detail
-
getKeyUsername
String getKeyUsername()
Parameter name of username.
-
setKeyUsername
void setKeyUsername(String keyUsername)
Parameter name of username.
-
getKeyPassword
String getKeyPassword()
Parameter name of password.
-
setKeyPassword
void setKeyPassword(String keyPassword)
Parameter name of password.
-
getKeyToken
String getKeyToken()
The key used when parsing the token, which by default is equal to headerAuth
-
setKeyToken
void setKeyToken(String keyToken)
The key used when parsing the token, which by default is equal to headerAuth
-
getLoginUrl
String getLoginUrl()
Url to login
-
setLoginUrl
void setLoginUrl(String loginUrl)
Url to login
-
getUsername
String getUsername()
login username
-
setUsername
void setUsername(String username)
login username
-
getPassword
String getPassword()
login password
-
setPassword
void setPassword(String password)
login password
-
getHeaderAuth
String getHeaderAuth()
Set the header name of token. Note, it's not a cookie, cookie will be auto-completed
-
setHeaderAuth
void setHeaderAuth(String headerAuth)
Set the header name of token. Note, it's not a cookie, cookie will be auto-completed
-
getHeaderAccept
String getHeaderAccept()
-
setHeaderAccept
void setHeaderAccept(String headerAccept)
-
getHeaderUserAgent
String getHeaderUserAgent()
-
setHeaderUserAgent
void setHeaderUserAgent(String headerUserAgent)
-
getInitListener
Consumer<String> getInitListener()
-
setInitListener
void setInitListener(Consumer<String> initListener)
-
needToken
boolean needToken(@NotNull() Request request)
Whether to need token
-
fillToken
boolean fillToken(Request.Builder builder)
Set a valid token, usually in the header. `false` means the token is not valid, should try init
-
initToken
boolean initToken(@NotNull() Call.Factory callFactory)
try init token
-
isCookieAuto
boolean isCookieAuto()
Whether to use auto cookie mode, default false. If true, do auto login only if only response is 401, other actions are handled by the cookie mechanism.
-
setCookieAuto
void setCookieAuto(boolean cookieAuto)
Whether to use auto cookie mode, default false. If true, do auto login only if only response is 401, other actions are handled by the cookie mechanism.
-
-
-
-