Skip to content

Instantly share code, notes, and snippets.

@ikikko
Created July 16, 2011 13:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikikko/1086366 to your computer and use it in GitHub Desktop.
Save ikikko/1086366 to your computer and use it in GitHub Desktop.
Basic authentication Script for Script Security Realm
def url = 'http://example.com/'
Authenticator.default = {
[
// user
System.env.U,
// password
System.env.P.toCharArray()
]
} as Authenticator
// authentication by accessing to basic authentication url
try {
new URL(url).text
} catch (e) {
System.exit(1)
}
System.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment