This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* This script is intended to handle CAS (http://jasig.github.io/cas) authentication via ZAP. | |
* | |
* When working with CAS, a single POST request with the credentials is not enough to trigger the authentication. | |
* When we GET the login page, some input values used by CAS are generated (the login ticket and some Spring Web | |
* Flow related parameters), and they must be included in the POST request for the authentication to work. So | |
* this script basically sends a GET to the login page, parses its response looking for the values generated by | |
* CAS, and sends a POST request with these values and the credentials. | |
* | |
* This is enough to trigger the authentication, but it's not enough to enable a successfull authenticated scan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The authenticate function is called whenever ZAP requires to authenticate for a Context for which this script | |
// was selected as the Authentication Method. The function should send any messages that are required to do the authentication | |
// and should return a message with the authenticated response. | |
// | |
// NOTE: Any message sent in the function should be obtained using the 'helper.prepareMessage()' method. | |
// | |
// Parameters: | |
// helper - a helper class providing useful methods: prepareMessage(), sendAndReceive(msg) | |
// paramsValues - the values of the parameters configured in the Session Properties -> Authentication panel. | |
// The paramsValues is a map, having as keys the parameters names (as returned by the getRequiredParamsNames() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BooksViewModel(bookDao: BookDao) : ViewModel() { | |
private val booksAscending = bookDao.booksAscending() | |
private val booksDescending = bookDao.booksDescending() | |
val books = MediatorLiveData<List<Book>>() | |
private var currentOrder = ASCENDING | |
init { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BooksViewModel(bookDao: BookDao) : ViewModel() { | |
// to make things simpler here, let's skip the repository layer | |
val books = bookDao.books() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BooksViewModel(bookDao: BookDao) : ViewModel() { | |
// the LiveData from Room won't be exposed to the view... | |
private val dbBooks = bookDao.books() | |
// ...because this is what we'll want to expose | |
val books = MediatorLiveData<List<Book>>() | |
private var currentOrder = ASCENDING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
@Component(modules = [YourModule::class, ThatOtherModule::class]) | |
interface ApplicationComponent { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance fun applicationContext(applicationContext: Context): Builder | |
fun build(): ApplicationComponent | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/~\ | |
|oo ) This isn't the blogpost | |
_\=/_ you're looking for! | |
___ # / _ \ | |
/ ()\ \\//|/.\|\\ | |
_|_____|_ \/ \_/ || | |
| | === | | |\ /| || | |
|_| O |_| \_ _/ # | |
|| O || | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/~\ | |
|oo ) This isn't the blogpost | |
_\=/_ you're looking for! | |
___ # / _ \ | |
/ ()\ \\//|/.\|\\ | |
_|_____|_ \/ \_/ || | |
| | === | | |\ /| || | |
|_| O |_| \_ _/ # | |
|| O || | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/~\ | |
|oo ) This isn't the blogpost | |
_\=/_ you're looking for! | |
___ # / _ \ | |
/ ()\ \\//|/.\|\\ | |
_|_____|_ \/ \_/ || | |
| | === | | |\ /| || | |
|_| O |_| \_ _/ # | |
|| O || | | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/~\ | |
|oo ) This isn't the blogpost | |
_\=/_ you're looking for! | |
___ # / _ \ | |
/ ()\ \\//|/.\|\\ | |
_|_____|_ \/ \_/ || | |
| | === | | |\ /| || | |
|_| O |_| \_ _/ # | |
|| O || | | | |
OlderNewer