Skip to content

Instantly share code, notes, and snippets.

View watahani's full-sized avatar

WataruHaniyama watahani

View GitHub Profile
@watahani
watahani / b2c-native-authorize-code-example-with-refresh-token.ps1
Last active May 19, 2020 03:59
Azure AD B2C authorize code flow example for development purpose
# debug purpose only. DO NOT USE THIS SAMPL for Production.
$clientId = 'e105c4b1-4dae-457b-a586-a7c0f8d7fb17'
$redirectUri='https://login.microsoftonline.com/tfp/oauth2/nativeclient'
$tenant = "wahaniyab2c"
$policy = "B2C_1A_Susi"
$authority = "https://${tenant}.b2clogin.com/${tenant}.onmicrosoft.com/"
$tokenEndpoint = $authority + "${policy}/oauth2/v2.0/token"
$scope = "openid https://wahaniyab2c.onmicrosoft.com/api/Hello.Read https://wahaniyab2c.onmicrosoft.com/api/user_impersonation offline_access"
# すべてのユーザーに一括して会社電話番号での MFA を設定する
Get-MsolUser -All | ForEach {
$user = $_
$mfa = $user.StrongAuthenticationMethod
# MFA が何も設定されていない
if (-not $mfa) {
$twoWayOfficeDefaultTrue = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod
$twoWayOfficeDefaultTrue.MethodType = "TwoWayVoiceOffice"
$twoWayOfficeDefaultTrue.IsDefault = $True
netsh wlan show profiles | %{ $_.Split(":")[1]} | ?{$_ -ne $null -and ( $_ -notmatch "^\s*$" ) } | %{$_.trim()} | %{ netsh wlan show profile name="$_" key=clear} | ?{ $_ -like "*主*" -or ( $_ -like "*D 名*" ) }
@watahani
watahani / signup.html
Last active January 29, 2020 04:02
sample html adding term of service link
<!DOCTYPE html>
<html>
<head>
<title>User details</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
@watahani
watahani / pokemon_watt.hex
Created January 5, 2020 04:25
ワット回収するやつ。ワット回収後にインターバルを追加。
:10000000A6C00000BFC00000BDC00000BBC0000013
:10001000B9C00000B7C00000B5C00000B3C0000008
:10002000B1C00000AFC00000ADC0000068C4000057
:10003000A9C00000A7C00000A5C00000A3C0000028
:10004000A1C000009FC000009DC000009BC0000038
:1000500099C0000097C0000095C0000093C0000048
:1000600091C000008FC000008DC000008BC0000058
:1000700089C00000240350004F004B004B00450096
:100080004E00200043004F004E00540052004F002D
:100090004C004C004500520000001C0348004F007B
# Get all OAuth scopes
try {
$allAuth2PermissionsGrants = Get-AzureADOAuth2PermissionGrant -All $true
$allServicePrincipals = Get-AzureADServicePrincipal -All $true
$allUsers = Get-AzureADUser -All $true
$servicePrincipalScope = New-Object System.Collections.ArrayList
@watahani
watahani / welcome.html
Created December 1, 2019 14:19
fido2 b2c sample
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>User details</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="locale" content="en-US">
@watahani
watahani / self-asserted.html
Created December 1, 2019 14:16
fido2 sample
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>User details</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="locale" content="en-US">
@watahani
watahani / now.json
Created December 1, 2019 14:11
now.json webauthn api sample
{
"version": 2,
"builds": [
{ "src": "app.js", "use": "@now/node-server" }
],
"routes": [{
"src": "/challenge",
"dest": "/app.js"
},
{
-----BEGIN CERTIFICATE-----
MIIDozCCAougAwIBAgIQAKS459X1ThBgnDrB/pGqeTANBgkqhkiG9w0BAQsFADBq
MSswKQYDVQQLDCJDcmVhdGVkIGJ5IGh0dHA6Ly93d3cuZmlkZGxlcjIuY29tMRgw
FgYDVQQKDA9ET19OT1RfVFJVU1RfQkMxITAfBgNVBAMMGERPX05PVF9UUlVTVF9G
aWRkbGVyUm9vdDAeFw0xOTA5MzAwMDAwMDBaFw0yOTEwMDcxMTMzMTVaMGoxKzAp
BgNVBAsMIkNyZWF0ZWQgYnkgaHR0cDovL3d3dy5maWRkbGVyMi5jb20xGDAWBgNV
BAoMD0RPX05PVF9UUlVTVF9CQzEhMB8GA1UEAwwYRE9fTk9UX1RSVVNUX0ZpZGRs
ZXJSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAgeVG/bBjshPh
KuwdQsPchmrOe8XmLZgQl6YA7gU/T+Yia/G1Zf6dgw0UyTYbZRkNvi4DcS5okZMs
rQlCcgqzExn9VBHwzxAiacpznjHrxnZyOfAgmE0eCMhU/o8/m4ZzQtqCWPulLRxR